예제 #1
0
        public bool TryGetAverageCachedRoomGroupTemp(RoomGroup r, out float result)
        {
            CellIndices cellIndices = this.map.cellIndices;

            foreach (IntVec3 current in r.Cells)
            {
                CachedTempInfo item = this.map.temperatureCache.tempCache[cellIndices.CellToIndex(current)];
                if (item.numCells > 0 && !this.processedRoomGroupIDs.Contains(item.roomGroupID))
                {
                    this.relevantTempInfoList.Add(item);
                    this.processedRoomGroupIDs.Add(item.roomGroupID);
                }
            }
            int   num  = 0;
            float num2 = 0f;

            foreach (CachedTempInfo current2 in this.relevantTempInfoList)
            {
                num  += current2.numCells;
                num2 += current2.temperature * (float)current2.numCells;
            }
            result = num2 / (float)num;
            bool result2 = !this.relevantTempInfoList.NullOrEmpty <CachedTempInfo>();

            this.processedRoomGroupIDs.Clear();
            this.relevantTempInfoList.Clear();
            return(result2);
        }
예제 #2
0
        public static CachedTempInfo NewCachedTempInfo()
        {
            CachedTempInfo result = default(CachedTempInfo);

            result.Reset();
            return(result);
        }
 public bool TryGetAverageCachedRoomGroupTemp(RoomGroup r, out float result)
 {
     CellIndices cellIndices = map.cellIndices;
     foreach (IntVec3 cell in r.Cells)
     {
         CachedTempInfo item = map.temperatureCache.tempCache[cellIndices.CellToIndex(cell)];
         if (item.numCells > 0 && !processedRoomGroupIDs.Contains(item.roomGroupID))
         {
             relevantTempInfoList.Add(item);
             processedRoomGroupIDs.Add(item.roomGroupID);
         }
     }
     int num = 0;
     float num2 = 0f;
     foreach (CachedTempInfo relevantTempInfo in relevantTempInfoList)
     {
         num += relevantTempInfo.numCells;
         num2 += relevantTempInfo.temperature * (float)relevantTempInfo.numCells;
     }
     result = num2 / (float)num;
     bool result2 = !relevantTempInfoList.NullOrEmpty();
     processedRoomGroupIDs.Clear();
     relevantTempInfoList.Clear();
     return result2;
 }
예제 #4
0
 private void SetCachedCellInfo(IntVec3 c, CachedTempInfo info)
 {
     this.tempCache[this.map.cellIndices.CellToIndex(c)] = info;
 }