Пример #1
0
    public static void GenerateChunkDecoration(Chunk chunk)
    {
        int gx = (int)chunk.Position.x * 16;
        int gz = (int)chunk.Position.y * 16;

        for (int x = 0; x < Chunk.CHUNK_SIZE; x++)
        {
            for (int z = 0; z < Chunk.CHUNK_SIZE; z++)
            {
                BIOME_TYPE biome = GetBiome(gx + x, gz + z);
                switch (biome)
                {
                case BIOME_TYPE.Plains:
                    PlainBiome.GenerateVegetation(ref chunk, x, z);
                    break;

                case BIOME_TYPE.Desert:
                    DesertBiome.GenerateVegetation(ref chunk, x, z);
                    break;

                case BIOME_TYPE.Sea:
                    SeaBiome.GenerateVegetation(ref chunk, x, z);
                    break;

                case BIOME_TYPE.Forest:
                    ForestBiome.GenerateVegetation(ref chunk, x, z);
                    break;
                }
            }
        }
    }
Пример #2
0
    public static Biome SelectBiome(Vector3 chunkPos)
    {
        float temperature = ChunkUtils.GenerateTemperature(chunkPos.x / World.chunkSize, chunkPos.z / World.chunkSize);
        float moisture    = ChunkUtils.GenerateMoisture(chunkPos.x / World.chunkSize, chunkPos.z / World.chunkSize);
        Biome biome       = new DefaultBiome();

        if (temperature < 0.45f)
        {
            biome = new SnowBiome();
        }
        else
        {
            if (moisture < 0.4f && temperature > 0.6f)
            {
                biome = new DesertBiome();
            }
            else
            {
                biome = new DefaultBiome();
            }
        }
        return(biome);
    }