Ejemplo n.º 1
0
    public Biome getBiome(Vector3i position)
    {
        if (caveNoise3D.GetNoise(position.x, position.y, position.z) > 0.7f && position.y >= 2)
        {
            return(null);
        }

        int noise = (int)Math.Floor(biomeNoise3D.GetNoise(position.x, position.y, position.z) / (1.0f / biomes.Count));

        if (noise == biomes.Count)
        {
            noise--;
        }
        Biome tmpBiome = (Biome)biomes.GetByIndex(noise);

        if (tmpBiome != currentBiome)
        {
            biomeNoise3D.setScale(1.0f / tmpBiome.persistence);
        }
        if (noise >= 0 && noise < biomes.Count)
        {
            currentBiome = tmpBiome;
        }
        return(currentBiome);
    }