Exemplo n.º 1
0
        private void AddRocks()
        {
            //Add rocks to this chunk
            GameObject RockHolderObj = new GameObject();

            RockHolderObj.name             = "RockAssets";
            RockHolderObj.transform.parent = Terrain.transform;
            RocksComponent             = RockHolderObj.AddComponent <ChunkRockGenerator>();
            RocksComponent.ParentChunk = this;
            RocksComponent.Generate();
        }
Exemplo n.º 2
0
        public void Remove()
        {
            Heightmap = null;
            Settings  = null;

            if (Neighborhood.XDown != null)
            {
                Neighborhood.XDown.RemoveFromNeighborhood(this);
                Neighborhood.XDown = null;
            }
            if (Neighborhood.XUp != null)
            {
                Neighborhood.XUp.RemoveFromNeighborhood(this);
                Neighborhood.XUp = null;
            }
            if (Neighborhood.ZDown != null)
            {
                Neighborhood.ZDown.RemoveFromNeighborhood(this);
                Neighborhood.ZDown = null;
            }
            if (Neighborhood.ZUp != null)
            {
                Neighborhood.ZUp.RemoveFromNeighborhood(this);
                Neighborhood.ZUp = null;
            }

            if (FeatureComponent != null)
            {
                FeatureComponent.DestroyAllAssets();
            }
            if (TreesComponent != null)
            {
                TreesComponent.DestroyAllAssets();
            }
            if (RocksComponent != null)
            {
                RocksComponent.DestroyAllAssets();
            }
            if (Terrain != null)
            {
                GameObject.Destroy(Terrain.gameObject);
            }
        }