コード例 #1
0
 /// <summary>
 /// Checks the first dirty room in the DirtyRooms list, finds the nearest available cleaner and notifies that cleaner
 /// </summary>
 private void CheckDirtyRooms()
 {
     if (DirtyRooms.Count > 0 && Humans.OfType <Cleaner>().Where(c => !c.Cleaning) != null && !Evacuating)
     {
         try
         {
             GetNearestCleaner().GoCleanRoom(DirtyRooms[0]);
             DirtyRooms.Remove(DirtyRooms[0]);
             CheckDirtyRooms();
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Check visitor out by deleting it and set his room on : to be cleaned.
 /// // Set status of room Available
 /// </summary>
 /// <param name="human"></param>
 public void CheckVisitorOut(Human human)
 {
     for (int i = 0; i < Visitors.Count; i++)
     {
         if (human == Visitors[i])
         {
             // Room is dirty, so we set status on false
             Visitors[i].Room.CleaningStatus(false);
             // Add Visitor his room to dirytyroom list
             DirtyRooms.Add(Visitors[i].Room);
             // Set his room available to be hired again
             Visitors[i].Room.Empty = true;
             // Remove the visitor from the visitor list
             Visitors.Remove(Visitors[i]);
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Lobby is checking of there is a room to be cleaned. If so, the lobby will ask a cleaner to clean it
 /// </summary>
 public void CheckDirtyRooms()
 {
     // when there is a room to clean
     if (DirtyRooms.Count != 0)
     {
         // Loop in cleaners
         foreach (var item in Cleaners)
         {
             for (int specificRoom = 0; specificRoom < DirtyRooms.Count; specificRoom++)
             {
                 // if his status goingtowork is false
                 if (item.StatusCleaner == StatusCleaner.NOT_WORKING && item.Alive == true && item.StatusHuman != StatusHuman.EVACUATE)
                 {
                     ManageCleaner manageCleaner = new ManageCleaner();
                     manageCleaner.LetWorkerClean(DirtyRooms[specificRoom], Cleaners);
                     DirtyRooms.Remove(DirtyRooms[specificRoom]);
                 }
             }
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// Lobby gets a notification what room has to be placed in the dirtyroom list.
 /// </summary>
 /// <param name="evtData"></param>
 public void AddDirtyRoom(Dictionary <string, string> evtData)
 {
     foreach (KeyValuePair <string, string> item in evtData)
     {
         // if the dictionary it's key is "kamer"
         if (item.Key == "kamer")
         {
             // loop in rooms
             foreach (var room in Rooms)
             {
                 // Where room it's id is the same as the given id from the dicionary
                 if (room.ID.ToString() == item.Value)
                 {
                     // The room is dirty and has to be cleaned
                     room.CleaningStatus(false);
                     // Add the room to the to be cleaned list
                     DirtyRooms.Add(room);
                 }
             }
         }
     }
 }