コード例 #1
0
        public override void OnInspectorGUI()
        {
            CSFoliageInstantiator bm = (CSFoliageInstantiator)target;

            GUILayout.Box(banner, GUILayout.ExpandWidth(true));


            bm.originalObject = EditorGUILayout.ObjectField("Original Object", bm.originalObject, typeof(GameObject), true) as GameObject;
            if (GUILayout.Button("Update Template"))
            {
                bm.Awake();
                bm.UpdateElements();
            }

            bm.instancesX  = EditorGUILayout.IntField("Instances", bm.instancesX);
            bm.offsetX     = EditorGUILayout.IntField("Offset X", bm.offsetX);
            bm.instancesZ  = EditorGUILayout.IntField("Instances", bm.instancesZ);
            bm.offsetZ     = EditorGUILayout.IntField("Offset Z", bm.offsetZ);
            bm.width       = EditorGUILayout.IntField("Width", bm.width);
            bm.depth       = EditorGUILayout.IntField("Depth", bm.depth);
            bm.enterOffset = EditorGUILayout.FloatField("Move offset", bm.enterOffset);



            if (GUI.changed)
            {
                bm.Awake();
                bm.UpdateElements();

                EditorUtility.SetDirty(bm);
            }
        }
コード例 #2
0
        void OnEnable()
        {
            CSFoliageInstantiator bm = (CSFoliageInstantiator)target;

            banner = Resources.Load("CSHeader") as Texture;
            bm.Awake();
            bm.UpdateElements();
        }
コード例 #3
0
 public void UpdateTreesLods()
 {
     CSRandomizerComponent = gameObject.GetComponent <CityRandomizer>();
     csDetailsObject       = CSRandomizerComponent.foliage;
     foreach (Transform go in csDetailsObject.transform.Cast <Transform>().Reverse())
     {
         CSFoliageInstantiator poles = go.GetComponent(typeof(CSFoliageInstantiator)) as CSFoliageInstantiator;
         poles.offsetX = treeDistance;
         poles.offsetZ = treeDistance;
         poles.UpdateElements();
     }
 }