Esempio n. 1
0
    public void GenerateChunk(IChunk chunk, int maxHeight)
    {
        IBiome bg = _biomes[0];

        for (int x = 0; x < chunk.Blocks.GetLength(0); x++)
        {
            for (int y = 0; y < chunk.Blocks.GetLength(1); y++)
            {
                for (int z = 0; z < chunk.Blocks.GetLength(2); z++)
                {
                    if (bg.GetValue(chunk.LocalPositionToWorldPosition(x, y, z), maxHeight) == 1)
                        chunk[x, y, z] = bg.GetBlockFromPosition(chunk.ChunkPosition + new IntVector3(x, y, z), maxHeight);
                    else
                        chunk[x, y, z] = null;
                }
            }
        }

        //Chunk is finished loading
        chunk.IsLoaded = true;
        chunk.UpdateNeighbouringChunks();
    }