Пример #1
0
        public virtual IEnumerable <IntVec3> ExplosionCellsToHit(IntVec3 center, Map map, float radius)
        {
            openCells.Clear();
            adjWallCells.Clear();
            int num = GenRadial.NumCellsInRadius(radius);

            for (int i = 0; i < num; i++)
            {
                IntVec3 intVec = center + GenRadial.RadialPattern[i];
                if (intVec.InBounds(map) && GenSight.LineOfSight(center, intVec, map, skipFirstCell: true))
                {
                    openCells.Add(intVec);
                }
            }
            for (int j = 0; j < openCells.Count; j++)
            {
                IntVec3 intVec2 = openCells[j];
                if (intVec2.Walkable(map))
                {
                    for (int k = 0; k < 4; k++)
                    {
                        IntVec3 intVec3 = intVec2 + GenAdj.CardinalDirections[k];
                        if (intVec3.InHorDistOf(center, radius) && intVec3.InBounds(map) && !intVec3.Standable(map) && intVec3.GetEdifice(map) != null && !openCells.Contains(intVec3) && adjWallCells.Contains(intVec3))
                        {
                            adjWallCells.Add(intVec3);
                        }
                    }
                }
            }
            return(openCells.Concat(adjWallCells));
        }
Пример #2
0
        public virtual IEnumerable <IntVec3> ExplosionCellsToHit(IntVec3 center, Map map, float radius)
        {
            DamageWorker.openCells.Clear();
            DamageWorker.adjWallCells.Clear();
            int num = GenRadial.NumCellsInRadius(radius);

            for (int i = 0; i < num; i++)
            {
                IntVec3 intVec = center + GenRadial.RadialPattern[i];
                if (intVec.InBounds(map))
                {
                    if (GenSight.LineOfSight(center, intVec, map, true, null, 0, 0))
                    {
                        DamageWorker.openCells.Add(intVec);
                    }
                }
            }
            for (int j = 0; j < DamageWorker.openCells.Count; j++)
            {
                IntVec3 intVec2 = DamageWorker.openCells[j];
                if (intVec2.Walkable(map))
                {
                    for (int k = 0; k < 4; k++)
                    {
                        IntVec3 intVec3 = intVec2 + GenAdj.CardinalDirections[k];
                        if (intVec3.InHorDistOf(center, radius))
                        {
                            if (intVec3.InBounds(map))
                            {
                                if (!intVec3.Standable(map))
                                {
                                    if (intVec3.GetEdifice(map) != null)
                                    {
                                        if (!DamageWorker.openCells.Contains(intVec3) && DamageWorker.adjWallCells.Contains(intVec3))
                                        {
                                            DamageWorker.adjWallCells.Add(intVec3);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(DamageWorker.openCells.Concat(DamageWorker.adjWallCells));
        }
 internal bool <> m__1(IntVec3 x)
 {
     for (int i = 0; i < 5; i++)
     {
         IntVec3 intVec = x + GenAdj.CardinalDirectionsAndInside[i];
         if (intVec.InBounds(this.map) && intVec.InHorDistOf(this.c, 6.9f))
         {
             Building edifice = intVec.GetEdifice(this.map);
             if (edifice != null && edifice.def.holdsRoof)
             {
                 this.connected = true;
                 return(true);
             }
         }
     }
     return(false);
 }
        public static bool WithinRangeOfRoofHolder(IntVec3 c, Map map, bool assumeNonNoRoofCellsAreRoofed = false)
        {
            bool connected = false;

            map.floodFiller.FloodFill(c, (IntVec3 x) => (x.Roofed(map) || x == c || (assumeNonNoRoofCellsAreRoofed && !map.areaManager.NoRoof[x])) && x.InHorDistOf(c, 6.9f), delegate(IntVec3 x)
            {
                for (int i = 0; i < 5; i++)
                {
                    IntVec3 c2 = x + GenAdj.CardinalDirectionsAndInside[i];
                    if (c2.InBounds(map) && c2.InHorDistOf(c, 6.9f))
                    {
                        Building edifice = c2.GetEdifice(map);
                        if (edifice != null && edifice.def.holdsRoof)
                        {
                            connected = true;
                            return(true);
                        }
                    }
                }
                return(false);
            }, int.MaxValue, false, null);
            return(connected);
        }
 internal bool <> m__0(IntVec3 x)
 {
     return((x.Roofed(this.map) || x == this.c || (this.assumeNonNoRoofCellsAreRoofed && !this.map.areaManager.NoRoof[x])) && x.InHorDistOf(this.c, 6.9f));
 }