Ejemplo n.º 1
0
 private void CreateOrAttachToExistingRoomGroups(int numRoomGroups)
 {
     for (int i = 0; i < numRoomGroups; i++)
     {
         currentRoomGroup.Clear();
         foreach (Room reusedOldRoom in reusedOldRooms)
         {
             if (reusedOldRoom.newOrReusedRoomGroupIndex == i)
             {
                 currentRoomGroup.Add(reusedOldRoom);
             }
         }
         for (int j = 0; j < newRooms.Count; j++)
         {
             if (newRooms[j].newOrReusedRoomGroupIndex == i)
             {
                 currentRoomGroup.Add(newRooms[j]);
             }
         }
         bool      multipleOldNeighborRoomGroups;
         RoomGroup roomGroup = FindCurrentRoomGroupNeighborWithMostRegions(out multipleOldNeighborRoomGroups);
         if (roomGroup == null)
         {
             RoomGroup roomGroup2 = RoomGroup.MakeNew(map);
             FloodAndSetRoomGroups(currentRoomGroup[0], roomGroup2);
             newRoomGroups.Add(roomGroup2);
         }
         else if (!multipleOldNeighborRoomGroups)
         {
             for (int k = 0; k < currentRoomGroup.Count; k++)
             {
                 currentRoomGroup[k].Group = roomGroup;
             }
             reusedOldRoomGroups.Add(roomGroup);
         }
         else
         {
             FloodAndSetRoomGroups(currentRoomGroup[0], roomGroup);
             reusedOldRoomGroups.Add(roomGroup);
         }
     }
 }
Ejemplo n.º 2
0
 private void CreateOrAttachToExistingRoomGroups(int numRoomGroups)
 {
     for (int i = 0; i < numRoomGroups; i++)
     {
         this.currentRoomGroup.Clear();
         foreach (Room room in this.reusedOldRooms)
         {
             if (room.newOrReusedRoomGroupIndex == i)
             {
                 this.currentRoomGroup.Add(room);
             }
         }
         for (int j = 0; j < this.newRooms.Count; j++)
         {
             if (this.newRooms[j].newOrReusedRoomGroupIndex == i)
             {
                 this.currentRoomGroup.Add(this.newRooms[j]);
             }
         }
         bool      flag;
         RoomGroup roomGroup = this.FindCurrentRoomGroupNeighborWithMostRegions(out flag);
         if (roomGroup == null)
         {
             RoomGroup roomGroup2 = RoomGroup.MakeNew(this.map);
             this.FloodAndSetRoomGroups(this.currentRoomGroup[0], roomGroup2);
             this.newRoomGroups.Add(roomGroup2);
         }
         else if (!flag)
         {
             for (int k = 0; k < this.currentRoomGroup.Count; k++)
             {
                 this.currentRoomGroup[k].Group = roomGroup;
             }
             this.reusedOldRoomGroups.Add(roomGroup);
         }
         else
         {
             this.FloodAndSetRoomGroups(this.currentRoomGroup[0], roomGroup);
             this.reusedOldRoomGroups.Add(roomGroup);
         }
     }
 }