コード例 #1
0
ファイル: Habitats.cs プロジェクト: hueblerw/CavemanLand
        public Dictionary <string, double[]> getYearOfGatherables(DailyTemps dailyTemps, DailyRain dailyRain, DailyVolume dailyVolume)
        {
            if (crops == null)
            {
                crops = new Dictionary <string, double[]>();
                List <string> activeHabitats            = getNonZeroHabitats();
                Dictionary <string, Plant> plantSpecies = World.plantSpecies;
                foreach (KeyValuePair <string, Plant> pair in plantSpecies)
                {
                    double habitatPercentage = 0.0;
                    if (pair.Value.habitats.Contains("All"))
                    {
                        habitatPercentage = (100 - typePercents[13] - typePercents[12]) * .01;
                    }
                    else if (pair.Value.habitats.Any(habitat => activeHabitats.Contains(habitat)))
                    {
                        foreach (string habitat in pair.Value.habitats)
                        {
                            habitatPercentage += typePercents[reverseHabitatMapping[habitat]] * .01;
                        }
                    }
                    if (!habitatPercentage.Equals(0.0))
                    {
                        double[] cropHistory = pair.Value.getYearOfCrop(habitatPercentage, dailyTemps, dailyRain, dailyVolume);
                        if (cropHistory != null)
                        {
                            crops.Add(pair.Key, cropHistory);
                        }
                    }
                }
            }

            return(crops);
        }
コード例 #2
0
 public void setDailyRain(DailyRain dailyRain)
 {
     this.dailyRain = dailyRain;
 }