272 lines
4.8 KiB
C#
272 lines
4.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class object_class
|
|
{
|
|
public bool foldout;
|
|
|
|
public bool prefab;
|
|
|
|
public bool data_foldout;
|
|
|
|
public bool transform_foldout;
|
|
|
|
public bool settings_foldout;
|
|
|
|
public bool distance_foldout;
|
|
|
|
public bool rotation_foldout;
|
|
|
|
public bool rotation_map_foldout;
|
|
|
|
public bool random_position;
|
|
|
|
public Transform lookAtObject;
|
|
|
|
public bool includeScale;
|
|
|
|
public GameObject object1;
|
|
|
|
public GameObject object2;
|
|
|
|
public string name;
|
|
|
|
public bool equal_density;
|
|
|
|
public Color color_object;
|
|
|
|
public Transform parent;
|
|
|
|
public bool parent_clear;
|
|
|
|
public string parent_name;
|
|
|
|
public bool combine;
|
|
|
|
public bool combine_total;
|
|
|
|
public int place_max;
|
|
|
|
public bool place_maximum;
|
|
|
|
public bool place_maximum_total;
|
|
|
|
public bool parent_set;
|
|
|
|
public Vector3 scale_start;
|
|
|
|
public Vector3 scale_end;
|
|
|
|
public float unlink_y;
|
|
|
|
public float unlink_z;
|
|
|
|
public bool unlink_foldout;
|
|
|
|
public bool scale_link;
|
|
|
|
public bool scale_link_start_y;
|
|
|
|
public bool scale_link_end_y;
|
|
|
|
public bool scale_link_start_z;
|
|
|
|
public bool scale_link_end_z;
|
|
|
|
public AnimationCurve scaleCurve;
|
|
|
|
public Vector3 rotation_start;
|
|
|
|
public Vector3 rotation_end;
|
|
|
|
public bool rotation_link;
|
|
|
|
public bool rotation_link_start_y;
|
|
|
|
public bool rotation_link_end_y;
|
|
|
|
public bool rotation_link_start_z;
|
|
|
|
public bool rotation_link_end_z;
|
|
|
|
public Vector3 position_start;
|
|
|
|
public Vector3 position_end;
|
|
|
|
public bool terrain_height;
|
|
|
|
public bool terrain_rotate;
|
|
|
|
public bool scale_steps;
|
|
|
|
public Vector3 scale_step;
|
|
|
|
public bool position_steps;
|
|
|
|
public Vector3 position_step;
|
|
|
|
public Vector3 parent_rotation;
|
|
|
|
public bool look_at_parent;
|
|
|
|
public bool rotation_steps;
|
|
|
|
public Vector3 rotation_step;
|
|
|
|
[NonSerialized]
|
|
public rotation_map_class rotation_map;
|
|
|
|
public Vector3 min_distance;
|
|
|
|
public distance_level_enum distance_level;
|
|
|
|
public distance_mode_enum distance_mode;
|
|
|
|
public rotation_mode_enum distance_rotation_mode;
|
|
|
|
public bool distance_include_scale;
|
|
|
|
public bool distance_include_scale_group;
|
|
|
|
public List<distance_class> objects_placed;
|
|
|
|
public int placed;
|
|
|
|
[NonSerialized]
|
|
public object_class placed_reference;
|
|
|
|
public int placed_prelayer;
|
|
|
|
public int mesh_length;
|
|
|
|
public int mesh_triangles;
|
|
|
|
public int mesh_combine;
|
|
|
|
public Vector3 mesh_size;
|
|
|
|
public material_class object_material;
|
|
|
|
public GameObject combine_parent;
|
|
|
|
public string combine_parent_name;
|
|
|
|
public bool combine_parent_name_input;
|
|
|
|
public float value;
|
|
|
|
public int prelayer_index;
|
|
|
|
public bool prelayer_created;
|
|
|
|
public string swap_text;
|
|
|
|
public bool swap_select;
|
|
|
|
public bool copy_select;
|
|
|
|
[NonSerialized]
|
|
public List<object_class> object_child;
|
|
|
|
public Texture2D preview_texture;
|
|
|
|
public bool pivot_center;
|
|
|
|
public bool raycast;
|
|
|
|
public int layerMask;
|
|
|
|
public float ray_length;
|
|
|
|
public float cast_height;
|
|
|
|
public float ray_radius;
|
|
|
|
public Vector3 ray_direction;
|
|
|
|
public raycast_mode_enum raycast_mode;
|
|
|
|
public bool objectStream;
|
|
|
|
public int objectIndex;
|
|
|
|
public float slopeY;
|
|
|
|
public float sphereOverlapRadius;
|
|
|
|
public float sphereOverlapHeight;
|
|
|
|
public object_class()
|
|
{
|
|
random_position = true;
|
|
equal_density = true;
|
|
color_object = new Color(2f, 2f, 2f, 1f);
|
|
parent_clear = true;
|
|
combine_total = true;
|
|
place_max = 1;
|
|
scale_start = new Vector3(1f, 1f, 1f);
|
|
scale_end = new Vector3(1f, 1f, 1f);
|
|
unlink_y = 0.25f;
|
|
unlink_z = 0.25f;
|
|
scale_link = true;
|
|
scale_link_start_y = true;
|
|
scale_link_end_y = true;
|
|
scale_link_start_z = true;
|
|
scale_link_end_z = true;
|
|
scaleCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
|
|
rotation_start = new Vector3(0f, 0f, 0f);
|
|
rotation_end = new Vector3(0f, 0f, 0f);
|
|
position_start = new Vector3(0f, 0f, 0f);
|
|
position_end = new Vector3(0f, 0f, 0f);
|
|
terrain_height = true;
|
|
rotation_map = new rotation_map_class();
|
|
distance_include_scale = true;
|
|
distance_include_scale_group = true;
|
|
objects_placed = new List<distance_class>();
|
|
object_material = new material_class();
|
|
combine_parent_name = string.Empty;
|
|
swap_text = "S";
|
|
object_child = new List<object_class>();
|
|
ray_length = 20f;
|
|
cast_height = 20f;
|
|
ray_radius = 1f;
|
|
ray_direction = new Vector3(0f, -1f, 0f);
|
|
}
|
|
|
|
public virtual void count_mesh()
|
|
{
|
|
if ((bool)object1)
|
|
{
|
|
MeshFilter meshFilter = (MeshFilter)object1.GetComponent(typeof(MeshFilter));
|
|
Mesh mesh = null;
|
|
Vector3[] array = null;
|
|
int[] array2 = null;
|
|
if ((bool)meshFilter)
|
|
{
|
|
mesh = meshFilter.sharedMesh;
|
|
}
|
|
if ((bool)mesh)
|
|
{
|
|
array = mesh.vertices;
|
|
mesh_size = mesh.bounds.size;
|
|
array2 = mesh.triangles;
|
|
}
|
|
if (array != null)
|
|
{
|
|
mesh_length = array.Length;
|
|
mesh_combine = Mathf.FloorToInt(63000 / mesh_length);
|
|
mesh_triangles = array2.Length;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mesh_combine = 0;
|
|
mesh_size = new Vector3(0f, 0f, 0f);
|
|
mesh_length = 0;
|
|
mesh_triangles = 0;
|
|
}
|
|
}
|
|
}
|