private static void DrawFertilityAroundMouse()
 {
     if (!PlaySettingsPatch.showFertilityOverlay)
     {
         return;
     }
     FertilityUtility.FillFertilityRelevantCells(UI.MouseCell(), Find.CurrentMap);
     for (int i = 0; i < FertilityUtility.fertilityRelevantCells.Count; i++)
     {
         IntVec3 intVec = FertilityUtility.fertilityRelevantCells[i];
         float   num    = FertilityUtility.CellFertility(intVec, Find.CurrentMap, FertilityDrawer.fertilityCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(intVec);
             GenMapUI.DrawThingLabel(v, num.ToString("n1"), FertilityDrawer.FertilityColor(num, 1.4f));
         }
     }
     FertilityDrawer.fertilityCountedThings.Clear();
 }
Пример #2
0
 private static void DrawFertilityAroundMouse()
 {
     if (!Find.PlaySettings.showFertilityOverlay)
     {
         return;
     }
     // Prevent overlap with beauty display
     if (Find.PlaySettings.showBeauty)
     {
         return;
     }
     FertilityUtility.FillFertilityRelevantCells(UI.MouseCell(), Find.CurrentMap);
     foreach (var cell in FertilityUtility.fertilityRelevantCells)
     {
         float num = FertilityUtility.CellFertility(cell, Find.CurrentMap, FertilityDrawer.fertilityCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(cell);
             GenMapUI.DrawThingLabel(v, num.ToString("n1"), FertilityDrawer.FertilityColor(num, 1.4f));
         }
     }
     FertilityDrawer.fertilityCountedThings.Clear();
 }
        public static float AverageFertilityPerceptible(IntVec3 root, Map map)
        {
            if (!root.IsValid || !root.InBounds(map))
            {
                return(0f);
            }
            FertilityUtility.tempCountedThings.Clear();
            float num  = 0f;
            int   num2 = 0;

            FertilityUtility.FillFertilityRelevantCells(root, map);
            for (int i = 0; i < FertilityUtility.fertilityRelevantCells.Count; i++)
            {
                num += FertilityUtility.CellFertility(FertilityUtility.fertilityRelevantCells[i], map, FertilityUtility.tempCountedThings);
                num2++;
            }
            FertilityUtility.tempCountedThings.Clear();
            if (num2 == 0)
            {
                return(0f);
            }
            return(num / (float)num2);
        }