コード例 #1
0
        /// <summary>
        /// Remove all children of the Biome Creator
        /// </summary>
        public void RemoveContainerChildren()
        {
            GameObject container = editor.extension.transform.gameObject as GameObject;

            // Workaround for a RAM bug: Simulated meshes don't get removed after the spline got deleted => we delete them manually
            // TODO: remove after RAM gameobject deletion got fixed
            if (editor.processingModule.GetSelectedPartitionAlgorithm() == PartitionAlgorithm.River)
            {
                RiverModule.RemoveRiverSimulationMeshes(container);
            }

            // register undo
            Undo.RegisterFullObjectHierarchyUndo(container, "Remove " + container);

            List <Transform> list = new List <Transform>();

            foreach (Transform child in container.transform)
            {
                list.Add(child);
            }

            foreach (Transform child in list)
            {
                GameObject go = child.gameObject;

                BiomeMaskSpawnerExtensionEditor.DestroyImmediate(go);
            }
        }
        public void OnEnable()
        {
            this.editor = this;

            VegetationStudioInstance = VegetationStudioProUtils.FindVegetationStudioInstance();

            extension = (BiomeMaskSpawnerExtension)target;

            #region settings modules
            rectangularPartitionModule = new RectangularPartitionModule(this);
            voronoiModule    = new VoronoiModule(this);
            hexagonModule    = new HexagonModule(this);
            lineModule       = new LineModule(this);
            lakeModule       = new LakeModule(this);
            shapeModule      = new ShapeModule(this);
            biomeModule      = new BiomeModule(this);
            processingModule = new ProcessingModule(this);
            riverModule      = new RiverModule(this);
            roadModule       = new RoadModule(this);
            #endregion settings modules

            #region action modules
            maskCreationActionModule        = new MaskCreationActionModule(this);
            roadCreationActionModule        = new RoadCreationActionModule(this);
            vegetationStudioProActionModule = new VegetationStudioProActionModule(this);
            #endregion action modules

            #region module OnEnable

            biomeModule.OnEnable();
            lakeModule.OnEnable();
            shapeModule.OnEnable();
            processingModule.OnEnable();
            rectangularPartitionModule.OnEnable();
            voronoiModule.OnEnable();
            hexagonModule.OnEnable();
            lineModule.OnEnable();
            riverModule.OnEnable();
            roadModule.OnEnable();

            #endregion module OnEnable

            #region Consistency Check

            performInitialConsistencyCheck = true;

            #endregion Consistency Check
        }