コード例 #1
0
        // Token: 0x0600368E RID: 13966 RVA: 0x001A127C File Offset: 0x0019F67C
        private static void CalculateLocationCandidates(Map map, bool allowFogged = false, bool allowUnroofed = false, bool allowDigging = false, bool forceNew = false)
        {
            int minscore = (allowUnroofed ? 0 : (allowDigging ? 15000 : 10000));
            MapComponent_HiveGrid hiveGrid = map.HiveGrid();

            InfestationLikeCellFinder.locationCandidates.Clear();
            InfestationLikeCellFinder.CalculateTraversalDistancesToUnroofed(map);
            InfestationLikeCellFinder.CalculateClosedAreaSizeGrid(map);
            InfestationLikeCellFinder.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);
                    if (!forceNew || !(hiveGrid.Hivelist.Any(x => x.Position == cell) || hiveGrid.hiveLoclist.Any(x => x == cell)))
                    {
                    }
                    float scoreAt = InfestationLikeCellFinder.GetScoreAt(cell, map, allowFogged, allowUnroofed, allowDigging); // allowFogged

                    if (scoreAt > minscore)
                    {
                        //    Log.Message(string.Format("scoreAt {0} == {1}", cell, scoreAt));
                        InfestationLikeCellFinder.locationCandidates.Add(new InfestationLikeCellFinder.LocationCandidate(cell, scoreAt));
                    }
                }
            }
        }
コード例 #2
0
 // Token: 0x0600368D RID: 13965 RVA: 0x001A1070 File Offset: 0x0019F470
 public static void DebugDraw()
 {
     if (DebugViewSettings.drawInfestationChance)
     {
         if (InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors == null)
         {
             InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors = new List <Pair <IntVec3, float> >();
         }
         if (Time.frameCount % 8 == 0)
         {
             InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors.Clear();
             Map      currentMap = Find.CurrentMap;
             CellRect cellRect   = Find.CameraDriver.CurrentViewRect;
             cellRect.ClipInsideMap(currentMap);
             cellRect = cellRect.ExpandedBy(1);
             InfestationLikeCellFinder.CalculateTraversalDistancesToUnroofed(currentMap);
             InfestationLikeCellFinder.CalculateClosedAreaSizeGrid(currentMap);
             InfestationLikeCellFinder.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 = InfestationLikeCellFinder.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 = InfestationLikeCellFinder.GetScoreAt(intVec, currentMap);
                         if (scoreAt2 > 7.5f)
                         {
                             float second = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2);
                             InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors.Add(new Pair <IntVec3, float>(intVec, second));
                         }
                     }
                 }
             }
         }
         for (int m = 0; m < InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors.Count; m++)
         {
             IntVec3 first   = InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors[m].First;
             float   second2 = InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors[m].Second;
             CellRenderer.RenderCell(first, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, second2), false));
         }
     }
     else
     {
         InfestationLikeCellFinder.tmpCachedInfestationChanceCellColors = null;
     }
 }
コード例 #3
0
 // Token: 0x0600368E RID: 13966 RVA: 0x001A127C File Offset: 0x0019F67C
 private static void CalculateLocationCandidates(Map map, bool allowFogged)
 {
     InfestationLikeCellFinder.locationCandidates.Clear();
     InfestationLikeCellFinder.CalculateTraversalDistancesToUnroofed(map);
     InfestationLikeCellFinder.CalculateClosedAreaSizeGrid(map);
     InfestationLikeCellFinder.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 = InfestationLikeCellFinder.GetScoreAt(cell, map, allowFogged); // allowFogged
             if (scoreAt > 0f)
             {
                 InfestationLikeCellFinder.locationCandidates.Add(new InfestationLikeCellFinder.LocationCandidate(cell, scoreAt));
             }
         }
     }
 }