예제 #1
0
        // Important note:
        // This list contains a fair amount of code duplication
        // this was the cause of simultaneously working on event implementation
        // we made this choice because of the limeted time we had to implement these
        // as cause the actions list has become to big and needs a good refactor
        // there is no time for this so it is an issue that needs to be rethought in the fututure

        /// <summary>
        /// Cecks if there is anything to clean
        /// </summary>
        private void _IsSomthingInQueue()
        {
            IArea toClean = Hotel.GetRoomToClean();

            if (toClean != null)
            {
                ToCleanList.Enqueue(new CleaningEvent()
                {
                    ToClean = toClean, Time = 2
                });
                Status = MovableStatus.GOING_TO_ROOM;
            }

            if (ToCleanList.Any())
            {
                Status = MovableStatus.GOING_TO_ROOM;
            }
        }
예제 #2
0
        /// <summary>
        /// Goes to a room which needs cleaning
        /// </summary>
        private void _GoToRoom()
        {
            if (Path.Any())
            {
                _Move();
            }
            else if (ToCleanList.Any())
            {
                _hteCalculateCounter = 0;
                FinalDes             = ToCleanList.First().ToClean;
                _hteTime             = ToCleanList.First().Time;
                SetPath(ToCleanList.First().ToClean);
            }

            if (Area == FinalDes)
            {
                Status = MovableStatus.CLEANING;
            }
        }
예제 #3
0
 /// <summary>
 /// Start cleaning a room
 /// </summary>
 private void _Cleaning()
 {
     if (_hteCalculateCounter == _hteTime)
     {
         if (ToCleanList.Any())
         {
             Status = MovableStatus.IDLE;
             ToCleanList.First().ToClean.AreaStatus = AreaStatus.EMPTY;
             ToCleanList.Dequeue();
         }
         else
         {
             Status = MovableStatus.IDLE;
         }
     }
     else
     {
         _hteCalculateCounter++;
     }
 }