Esempio n. 1
0
        /// <summary>
        /// Makes the guest leave the elevator
        /// </summary>
        private void _LeavingElevator()
        {
            if (Status == MovableStatus.EVACUATING || LastStatus == MovableStatus.EVACUATING)
            {
                _EvacuateSequence();
                return;
            }

            Path   = new Queue <IArea>(Dijkstra.GetShortestPathDijkstra(Area, FinalDes));
            Status = LastStatus;
        }
Esempio n. 2
0
        /// <summary>
        /// Leaves the elevator and assigns the correct status
        /// </summary>
        private void _LeavingElevator()
        {
            if (Status == MovableStatus.EVACUATING || LastStatus == MovableStatus.EVACUATING)
            {
                SetPath(Hotel.GetArea(typeof(Reception)));
                FinalDes   = Hotel.GetArea(typeof(Reception));
                Status     = MovableStatus.EVACUATING;
                LastStatus = MovableStatus.EVACUATING;
                return;
            }

            SetPath(FinalDes);

            Path   = new Queue <IArea>(Dijkstra.GetShortestPathDijkstra(Area, FinalDes));
            Status = LastStatus;
        }
Esempio n. 3
0
        /// <summary>
        /// Set a path to the requested destination
        /// </summary>
        /// <param name="destination">The IArea the movable wants to go to</param>
        public void SetPath(IArea destination)
        {
            if (Dijkstra.IsElevatorCloser(Area, destination) is Elevator && Status != MovableStatus.EVACUATING)
            {
                Path          = new Queue <IArea>(Dijkstra.GetShortestPathDijkstra(Area, Dijkstra.IsElevatorCloser(Area, destination)));
                WantsElevator = true;
                LastStatus    = Status;
                Status        = MovableStatus.ELEVATOR_REQUEST;
            }
            else
            {
                Path = new Queue <IArea>(Dijkstra.GetShortestPathDijkstra(Area, destination));
            }


            // Count extra first step or not
            Path.Dequeue();
        }