// 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; } }
/// <summary> /// Handles incomming events /// </summary> /// <param name="evt">teh incomming event</param> public void Notify(HotelEvent evt) { if (evt.EventType == HotelEventType.EVACUATE) { Status = MovableStatus.EVACUATING; LastStatus = MovableStatus.EVACUATING; _hteCalculateCounter = 0; _hteTime = 5; } else if (evt.EventType.Equals(HotelEventType.CLEANING_EMERGENCY)) { CleaningEvent ce = new CleaningEvent(); foreach (var item in evt.Data) { if (item.Key.Contains("kamer")) { ce.ToClean = Hotel.GetAreaByID(int.Parse(item.Value)); if (Hotel.GetAreaByID(int.Parse(item.Value)).AreaStatus != AreaStatus.NEED_CLEANING) { Hotel.GetAreaByID(int.Parse(item.Value)).AreaStatus = AreaStatus.NEED_CLEANING; } else { return; } } if (item.Key.Contains("HTE")) { ce.Time = int.Parse(item.Value); } } ToCleanList.Enqueue(ce); } }