Ejemplo n.º 1
0
    private bool GenerateChunk(Vector3i chunkPos)
    {
        bool generated = false;

        for (int z = -1; z < Chunk.SIZE_Z + 1; z++)
        {
            for (int x = -1; x < Chunk.SIZE_X + 1; x++)
            {
                for (int y = 0; y < Chunk.SIZE_Y; y++)
                {
                    Vector3i worldPos = Chunk.ToWorldPosition(chunkPos, new Vector3i(x, y, z));

                    if (worldPos.y <= WATER_LEVEL && map.GetBlock(worldPos).IsEmpty())
                    {
                        map.SetBlock(water, worldPos);
                        generated = true;
                    }

                    int islandHeight = BiomeManager.getCurrentBiome().getHeight(worldPos.x, worldPos.z);
                    if (worldPos.y <= islandHeight)
                    {
                        GenerateBlockForIsland(worldPos, islandHeight - worldPos.y, islandHeight);
                        generated = true;
                        continue;
                    }
                }
            }
        }
        return(generated);
    }