public IEnumerator Generate(int cx, int cz) { if (generating) { yield return(null); } generating = true; //terrainNoise.GenerateNoise(cx*Chunk.SIZE_X, cz*Chunk.SIZE_Z); Biome.generateHeightNoise(cx * Chunk.SIZE_X, cz * Chunk.SIZE_Z); for (int cy = 0; true; cy++) { Vector3i worldPos = Chunk.ToWorldPosition(new Vector3i(cx, cy, cz), Vector3i.zero); //terrainNoise3D.GenerateNoise(worldPos); bmanager.generateNoise(worldPos); bool generated = GenerateChunk(new Vector3i(cx, cy, cz)); if (!generated) { break; } yield return(null); } generating = false; }