Exemple #1
0
    public Color GetColorFromBiome(float _elevation, float _moisture, float _latitude)
    {
        if (_latitude > 1 - settings.polesLatitude)
        {
            return(biomesColors[BiomeType.POLAR_ICE]);
        }

        if (_elevation < settings.oceanElevation)
        {
            return(biomesColors[BiomeType.WATER]);
        }

        if (_elevation > 0.95f)
        {
            return(biomesColors[BiomeType.POLAR_ICE]);
        }

        float temperature = Mathf.Lerp(settings.equatorTemperature, settings.polesTemperature, _latitude);

        temperature = temperature.Remap(-50.0f, settings.adjustBiomesWithOcean ? settings.oceanElevation : 0.0f, 50.0f, settings.adjustBiomesWithOcean ? 0.95f : 1.0f);

        float moisture = _moisture.Remap(0.0f, settings.adjustBiomesWithOcean ? settings.oceanElevation : 0.0f, 1.0f, 1.0f);

        TemperatureTypes temperatureType = GetTemperatureType(temperature * _elevation);
        MoistureTypes    moistureType    = GetMoistureType(moisture);
        BiomeType        biomeType       = GetBiomeType(temperatureType, moistureType);

        return(biomesColors[biomeType]);
    }
Exemple #2
0
    BiomeType GetBiomeType(TemperatureTypes _temperatureType, MoistureTypes _moistureType)
    {
        switch (_temperatureType)
        {
        case TemperatureTypes.POLAR:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.POLAR_DESERT);
            }

            default:
                return(BiomeType.POLAR_ICE);
            }
        }

        case TemperatureTypes.SUBPOLAR:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.SUBPOLAR_DRY_TUNDRA);
            }

            case MoistureTypes.PERARID:
            {
                return(BiomeType.SUBPOLAR_MOIST_TUNDRA);
            }

            case MoistureTypes.ARID:
            {
                return(BiomeType.SUBPOLAR_WET_TUNDRA);
            }

            default:
            {
                return(BiomeType.SUBPOLAR_RAIN_TUNDRA);
            }
            }
        }

        case TemperatureTypes.BOREAL:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.BOREAL_DESERT);
            }

            case MoistureTypes.PERARID:
            {
                return(BiomeType.BOREAL_DRY_SCRUB);
            }

            case MoistureTypes.ARID:
            {
                return(BiomeType.BOREAL_MOIST_FOREST);
            }

            case MoistureTypes.SEMIARID:
            {
                return(BiomeType.BOREAL_WET_FOREST);
            }

            default:
            {
                return(BiomeType.BOREAL_RAIN_FOREST);
            }
            }
        }

        case TemperatureTypes.COOL_TEMPERATE:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.COOL_TEMPERATE_DESERT);
            }

            case MoistureTypes.PERARID:
            {
                return(BiomeType.COOL_TEMPERATE_DESERT_SCRUB);
            }

            case MoistureTypes.ARID:
            {
                return(BiomeType.COOL_TEMPERATE_STEPPES);
            }

            case MoistureTypes.SEMIARID:
            {
                return(BiomeType.COOL_TEMPERATE_MOIST_FOREST);
            }

            case MoistureTypes.SUBHUMID:
            {
                return(BiomeType.COOL_TEMPERATE_WET_FOREST);
            }

            default:
            {
                return(BiomeType.COOL_TEMPERATE_RAIN_FOREST);
            }
            }
        }

        case TemperatureTypes.WARM_TEMPERATE:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.WARM_TEMPERATE_DESERT);
            }

            case MoistureTypes.PERARID:
            {
                return(BiomeType.WARM_TEMPERATE_DESERT_SCRUB);
            }

            case MoistureTypes.ARID:
            {
                return(BiomeType.WARM_TEMPERATE_THORN_SCRUB);
            }

            case MoistureTypes.SEMIARID:
            {
                return(BiomeType.WARM_TEMPERATE_DRY_FOREST);
            }

            case MoistureTypes.SUBHUMID:
            {
                return(BiomeType.WARM_TEMPERATE_MOIST_FOREST);
            }

            case MoistureTypes.HUMID:
            {
                return(BiomeType.WARM_TEMPERATE_WET_FOREST);
            }

            default:
            {
                return(BiomeType.WARM_TEMPERATE_RAIN_FOREST);
            }
            }
        }

        case TemperatureTypes.SUBTROPICAL:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.SUBTROPICAL_DESERT);
            }

            case MoistureTypes.PERARID:
            {
                return(BiomeType.SUBTROPICAL_DESERT_SCRUB);
            }

            case MoistureTypes.ARID:
            {
                return(BiomeType.SUBTROPICAL_THORN_WOODLAND);
            }

            case MoistureTypes.SEMIARID:
            {
                return(BiomeType.SUBTROPICAL_DRY_FOREST);
            }

            case MoistureTypes.SUBHUMID:
            {
                return(BiomeType.SUBTROPICAL_MOIST_FOREST);
            }

            case MoistureTypes.HUMID:
            {
                return(BiomeType.SUBTROPICAL_WET_FOREST);
            }

            default:
            {
                return(BiomeType.SUBTROPICAL_RAIN_FOREST);
            }
            }
        }

        case TemperatureTypes.TROPICAL:
        {
            switch (_moistureType)
            {
            case MoistureTypes.SUPERARID:
            {
                return(BiomeType.TROPICAL_DESERT);
            }

            case MoistureTypes.PERARID:
            {
                return(BiomeType.TROPICAL_DESERT_SCRUB);
            }

            case MoistureTypes.ARID:
            {
                return(BiomeType.TROPICAL_THORN_WOODLAND);
            }

            case MoistureTypes.SEMIARID:
            {
                return(BiomeType.TROPICAL_VERY_DRY_FOREST);
            }

            case MoistureTypes.SUBHUMID:
            {
                return(BiomeType.TROPICAL_DRY_FOREST);
            }

            case MoistureTypes.HUMID:
            {
                return(BiomeType.TROPICAL_MOIST_FOREST);
            }

            case MoistureTypes.PERHUMID:
            {
                return(BiomeType.TROPICAL_WET_FOREST);
            }

            default:
            {
                return(BiomeType.TROPICAL_RAIN_FOREST);
            }
            }
        }

        default:
            return(BiomeType.TROPICAL_RAIN_FOREST);
        }
    }