Esempio n. 1
0
 public void Deinitialize()
 {
     if (!initialized)
     {
         Debug.LogWarning("Terrain not initialized");
         return;
     }
     if (chunks != null)
     {
         EnumerateChunks(x => DestroyImmediate(x.gameObject));
         chunks = null;
     }
 }
Esempio n. 2
0
 private void CreateChunks(Vector3Int size, int chunkSize, float isolevel)
 {
     Debug.Log("Create chunks");
     this.chunkSize = chunkSize;
     chunks         = new ChunkGrid(size.x, size.y, size.z);
     for (int x = 0; x < chunks.X; x++)
     {
         for (int y = 0; y < chunks.Y; y++)
         {
             for (int z = 0; z < chunks.Z; z++)
             {
                 Vector3Int pos   = new Vector3Int(x, y, z) * chunkSize;
                 Chunk      chunk = CreateChunk(pos, isolevel);
                 chunks[x, y, z] = chunk;
             }
         }
     }
     UpdateBounds();
 }