示例#1
0
        public static bool UsesOutdoorTemperature(this IntVec3 c, Map map)
        {
            Room room = c.GetRoom(map, RegionType.Set_All);

            if (room != null)
            {
                return(room.UsesOutdoorTemperature);
            }
            Building edifice = c.GetEdifice(map);

            if (edifice != null)
            {
                IntVec3[] array = GenAdj.CellsAdjacent8Way(edifice).ToArray();
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].InBounds(map))
                    {
                        room = array[i].GetRoom(map, RegionType.Set_All);
                        if (room != null && room.UsesOutdoorTemperature)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            return(false);
        }
示例#2
0
        public static IEnumerable <IntVec3> CellsAdjacent8Way(TargetInfo pack)
        {
            if (pack.HasThing)
            {
                using (IEnumerator <IntVec3> enumerator = GenAdj.CellsAdjacent8Way(pack.Thing).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        IntVec3 c = enumerator.Current;
                        yield return(c);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            else
            {
                int i = 0;
                if (i < 8)
                {
                    yield return(pack.Cell + GenAdj.AdjacentCells[i]);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_013c:
            /*Error near IL_013d: Unexpected return in MoveNext()*/;
        }
示例#3
0
 public static bool TryFindRandomAdjacentCell8WayWithRoomGroup(IntVec3 center, Rot4 rot, IntVec2 size, Map map, out IntVec3 result)
 {
     GenAdj.AdjustForRotation(ref center, ref size, rot);
     GenAdj.validCells.Clear();
     foreach (IntVec3 current in GenAdj.CellsAdjacent8Way(center, rot, size))
     {
         if (current.InBounds(map) && current.GetRoomGroup(map) != null)
         {
             GenAdj.validCells.Add(current);
         }
     }
     return(GenAdj.validCells.TryRandomElement(out result));
 }
示例#4
0
 public static bool TryFindRandomAdjacentCell8WayWithRoomGroup(IntVec3 center, Rot4 rot, IntVec2 size, Map map, out IntVec3 result)
 {
     GenAdj.AdjustForRotation(ref center, ref size, rot);
     GenAdj.validCells.Clear();
     foreach (IntVec3 item in GenAdj.CellsAdjacent8Way(center, rot, size))
     {
         if (item.InBounds(map) && item.GetRoomGroup(map) != null)
         {
             GenAdj.validCells.Add(item);
         }
     }
     return(((IEnumerable <IntVec3>)GenAdj.validCells).TryRandomElement <IntVec3>(out result));
 }
示例#5
0
 public static IEnumerable <IntVec3> CellsAdjacent8Way(TargetInfo pack)
 {
     if (pack.HasThing)
     {
         foreach (IntVec3 c in GenAdj.CellsAdjacent8Way(pack.Thing))
         {
             yield return(c);
         }
     }
     else
     {
         for (int i = 0; i < 8; i++)
         {
             yield return(pack.Cell + GenAdj.AdjacentCells[i]);
         }
     }
 }
        internal void Notify_ThingAffectingRegionsDespawned(Thing b)
        {
            this.regionsToDirty.Clear();
            Region validRegionAt_NoRebuild = this.map.regionGrid.GetValidRegionAt_NoRebuild(b.Position);

            if (validRegionAt_NoRebuild != null)
            {
                this.map.temperatureCache.TryCacheRegionTempInfo(b.Position, validRegionAt_NoRebuild);
                this.regionsToDirty.Add(validRegionAt_NoRebuild);
            }
            foreach (IntVec3 item2 in GenAdj.CellsAdjacent8Way(b))
            {
                if (item2.InBounds(this.map))
                {
                    Region validRegionAt_NoRebuild2 = this.map.regionGrid.GetValidRegionAt_NoRebuild(item2);
                    if (validRegionAt_NoRebuild2 != null)
                    {
                        this.map.temperatureCache.TryCacheRegionTempInfo(item2, validRegionAt_NoRebuild2);
                        this.regionsToDirty.Add(validRegionAt_NoRebuild2);
                    }
                }
            }
            for (int i = 0; i < this.regionsToDirty.Count; i++)
            {
                this.SetRegionDirty(this.regionsToDirty[i], true);
            }
            this.regionsToDirty.Clear();
            if (b.def.size.x == 1 && b.def.size.z == 1)
            {
                this.dirtyCells.Add(b.Position);
            }
            else
            {
                CellRect cellRect = b.OccupiedRect();
                for (int j = cellRect.minZ; j <= cellRect.maxZ; j++)
                {
                    for (int k = cellRect.minX; k <= cellRect.maxX; k++)
                    {
                        IntVec3 item = new IntVec3(k, 0, j);
                        this.dirtyCells.Add(item);
                    }
                }
            }
        }
示例#7
0
 public static IEnumerable <IntVec3> CellsAdjacent8Way(Thing t)
 {
     return(GenAdj.CellsAdjacent8Way(t.Position, t.Rotation, t.def.size));
 }