コード例 #1
0
        private byte GetBiomeV0(double landFormType, double temperature, double moisture)
        {
            enuLandFormType landformtype = (enuLandFormType)landFormType;

            for (byte biomeId = 0; biomeId <= _config.ProcessorParam.Biomes.Count - 1; biomeId++)
            {
                Biome biome = _config.ProcessorParam.Biomes[biomeId];
                //Does this biome support this land form type ?
                if (biome.LandFormFilters.Contains(landformtype))
                {
                    //Check the temp range
                    if (temperature >= biome.TemperatureFilter.Min &&
                        temperature <= biome.TemperatureFilter.Max)
                    {
                        if (moisture >= biome.MoistureFilter.Min &&
                            moisture <= biome.MoistureFilter.Max)
                        {
                            return(biomeId);
                        }
                    }
                }
            }

            //By default return the first Biome from the list
            return((byte)0);
        }
コード例 #2
0
        private byte GetBiomeV1(double landFormType, double temperature, double moisture, double zone)
        {
            enuLandFormType landformtype = (enuLandFormType)landFormType;

            List <WeatherBiomes> biomeList;

            if (!_biomesConfig.TryGetValue(landformtype, out biomeList))
            {
                return((byte)0);
            }

            foreach (var weatherBiome in biomeList)
            {
                //Check the temp range
                if (weatherBiome.isWeatherBiomes)
                {
                    if (temperature >= weatherBiome.Temperature.Min &&
                        temperature <= weatherBiome.Temperature.Max &&
                        moisture >= weatherBiome.Moisture.Min &&
                        moisture <= weatherBiome.Moisture.Max)
                    {
                        if (weatherBiome.TotalBiomes == 1)
                        {
                            return(weatherBiome.BiomesListe[0].Id);
                        }
                        //Compute cell
                        //byte zoneLayer = (byte)(zone * (weatherBiome.Count));
                        //if (zoneLayer == weatherBiome.Count) zoneLayer--;
                        //return weatherBiome[zoneLayer].Id;
                        return(GetBiomeId(weatherBiome, zone));
                    }
                }
                else
                {
                    if (weatherBiome.TotalBiomes == 1)
                    {
                        return(weatherBiome.BiomesListe[0].Id);
                    }
                    //Compute cell
                    //byte zoneLayer = (byte)(zone * (weatherBiome.Count));
                    //if (zoneLayer == weatherBiome.Count) zoneLayer--;
                    //return weatherBiome[zoneLayer].Id;
                    return(GetBiomeId(weatherBiome, zone));
                }
            }

            //By default return the first Biome from the list
            return((byte)0);
        }