Exemple #1
0
 public static void DebugDraw()
 {
     if (DebugViewSettings.drawInfestationChance)
     {
         if (InfestationCellFinder.tmpCachedInfestationChanceCellColors == null)
         {
             InfestationCellFinder.tmpCachedInfestationChanceCellColors = new List <Pair <IntVec3, float> >();
         }
         if (Time.frameCount % 8 == 0)
         {
             InfestationCellFinder.tmpCachedInfestationChanceCellColors.Clear();
             Map      currentMap = Find.CurrentMap;
             CellRect cellRect   = Find.CameraDriver.CurrentViewRect;
             cellRect.ClipInsideMap(currentMap);
             cellRect = cellRect.ExpandedBy(1);
             InfestationCellFinder.CalculateTraversalDistancesToUnroofed(currentMap);
             InfestationCellFinder.CalculateClosedAreaSizeGrid(currentMap);
             InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(currentMap);
             float num = 0.001f;
             for (int i = 0; i < currentMap.Size.z; i++)
             {
                 for (int j = 0; j < currentMap.Size.x; j++)
                 {
                     IntVec3 cell    = new IntVec3(j, 0, i);
                     float   scoreAt = InfestationCellFinder.GetScoreAt(cell, currentMap);
                     if (scoreAt > num)
                     {
                         num = scoreAt;
                     }
                 }
             }
             for (int k = 0; k < currentMap.Size.z; k++)
             {
                 for (int l = 0; l < currentMap.Size.x; l++)
                 {
                     IntVec3 intVec = new IntVec3(l, 0, k);
                     if (cellRect.Contains(intVec))
                     {
                         float scoreAt2 = InfestationCellFinder.GetScoreAt(intVec, currentMap);
                         if (scoreAt2 > 7.5f)
                         {
                             float second = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2);
                             InfestationCellFinder.tmpCachedInfestationChanceCellColors.Add(new Pair <IntVec3, float>(intVec, second));
                         }
                     }
                 }
             }
         }
         for (int m = 0; m < InfestationCellFinder.tmpCachedInfestationChanceCellColors.Count; m++)
         {
             IntVec3 first   = InfestationCellFinder.tmpCachedInfestationChanceCellColors[m].First;
             float   second2 = InfestationCellFinder.tmpCachedInfestationChanceCellColors[m].Second;
             CellRenderer.RenderCell(first, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, second2), false));
         }
     }
     else
     {
         InfestationCellFinder.tmpCachedInfestationChanceCellColors = null;
     }
 }
Exemple #2
0
 private static void CalculateLocationCandidates(Map map)
 {
     InfestationCellFinder.locationCandidates.Clear();
     InfestationCellFinder.CalculateTraversalDistancesToUnroofed(map);
     InfestationCellFinder.CalculateClosedAreaSizeGrid(map);
     InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(map);
     for (int i = 0; i < map.Size.z; i++)
     {
         for (int j = 0; j < map.Size.x; j++)
         {
             IntVec3 cell    = new IntVec3(j, 0, i);
             float   scoreAt = InfestationCellFinder.GetScoreAt(cell, map);
             if (scoreAt > 0f)
             {
                 InfestationCellFinder.locationCandidates.Add(new InfestationCellFinder.LocationCandidate(cell, scoreAt));
             }
         }
     }
 }
Exemple #3
0
 public static void DebugDraw()
 {
     if (DebugViewSettings.drawInfestationChance)
     {
         Map      visibleMap = Find.VisibleMap;
         CellRect cellRect   = Find.CameraDriver.CurrentViewRect;
         cellRect.ClipInsideMap(visibleMap);
         cellRect = cellRect.ExpandedBy(1);
         InfestationCellFinder.CalculateTraversalDistancesToUnroofed(visibleMap);
         InfestationCellFinder.CalculateClosedAreaSizeGrid(visibleMap);
         InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(visibleMap);
         float num = 0.001f;
         for (int i = 0; i < visibleMap.Size.z; i++)
         {
             for (int j = 0; j < visibleMap.Size.x; j++)
             {
                 IntVec3 cell    = new IntVec3(j, 0, i);
                 float   scoreAt = InfestationCellFinder.GetScoreAt(cell, visibleMap);
                 if (scoreAt > num)
                 {
                     num = scoreAt;
                 }
             }
         }
         for (int k = 0; k < visibleMap.Size.z; k++)
         {
             for (int l = 0; l < visibleMap.Size.x; l++)
             {
                 IntVec3 intVec = new IntVec3(l, 0, k);
                 if (cellRect.Contains(intVec))
                 {
                     float scoreAt2 = InfestationCellFinder.GetScoreAt(intVec, visibleMap);
                     if (scoreAt2 > 0f)
                     {
                         float a = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2);
                         CellRenderer.RenderCell(intVec, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, a), false));
                     }
                 }
             }
         }
     }
 }
Exemple #4
0
        private static void CalculateLocationCandidates(Map map)
        {
            InfestationCellFinder.locationCandidates.Clear();
            InfestationCellFinder.CalculateTraversalDistancesToUnroofed(map);
            InfestationCellFinder.CalculateClosedAreaSizeGrid(map);
            InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(map);
            int num = 0;

            while (true)
            {
                int     num2 = num;
                IntVec3 size = map.Size;
                if (num2 < size.z)
                {
                    int num3 = 0;
                    while (true)
                    {
                        int     num4  = num3;
                        IntVec3 size2 = map.Size;
                        if (num4 < size2.x)
                        {
                            IntVec3 cell    = new IntVec3(num3, 0, num);
                            float   scoreAt = InfestationCellFinder.GetScoreAt(cell, map);
                            if (!(scoreAt <= 0.0))
                            {
                                InfestationCellFinder.locationCandidates.Add(new LocationCandidate(cell, scoreAt));
                            }
                            num3++;
                            continue;
                        }
                        break;
                    }
                    num++;
                    continue;
                }
                break;
            }
        }
Exemple #5
0
 public static void DebugDraw()
 {
     if (DebugViewSettings.drawInfestationChance)
     {
         Map      visibleMap = Find.VisibleMap;
         CellRect cellRect   = Find.CameraDriver.CurrentViewRect;
         cellRect.ClipInsideMap(visibleMap);
         cellRect = cellRect.ExpandedBy(1);
         InfestationCellFinder.CalculateTraversalDistancesToUnroofed(visibleMap);
         InfestationCellFinder.CalculateClosedAreaSizeGrid(visibleMap);
         InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(visibleMap);
         float num  = 0.001f;
         int   num2 = 0;
         while (true)
         {
             int     num3 = num2;
             IntVec3 size = visibleMap.Size;
             if (num3 < size.z)
             {
                 int num4 = 0;
                 while (true)
                 {
                     int     num5  = num4;
                     IntVec3 size2 = visibleMap.Size;
                     if (num5 < size2.x)
                     {
                         IntVec3 cell    = new IntVec3(num4, 0, num2);
                         float   scoreAt = InfestationCellFinder.GetScoreAt(cell, visibleMap);
                         if (scoreAt > num)
                         {
                             num = scoreAt;
                         }
                         num4++;
                         continue;
                     }
                     break;
                 }
                 num2++;
                 continue;
             }
             break;
         }
         int num6 = 0;
         while (true)
         {
             int     num7  = num6;
             IntVec3 size3 = visibleMap.Size;
             if (num7 < size3.z)
             {
                 int num8 = 0;
                 while (true)
                 {
                     int     num9  = num8;
                     IntVec3 size4 = visibleMap.Size;
                     if (num9 < size4.x)
                     {
                         IntVec3 intVec = new IntVec3(num8, 0, num6);
                         if (cellRect.Contains(intVec))
                         {
                             float scoreAt2 = InfestationCellFinder.GetScoreAt(intVec, visibleMap);
                             if (!(scoreAt2 <= 0.0))
                             {
                                 float a = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2);
                                 CellRenderer.RenderCell(intVec, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, a), false));
                             }
                         }
                         num8++;
                         continue;
                     }
                     break;
                 }
                 num6++;
                 continue;
             }
             break;
         }
     }
 }