예제 #1
0
        public void OnPositionSelection(Vector3 position, Vector3?facingDirection)
        {
            if (!Input.GetKey(KeyCode.LeftShift))
            {
                DestinationQueue.Clear();
            }

            DestinationQueue.Add(position);
            DestinationFacingDirection = facingDirection;
        }
예제 #2
0
        /// <summary>
        /// Queue the elevator to go to specified floor number.
        /// If you specify true as second argument, the elevator will go to that floor directly, and then go to any other queued floors.
        /// </summary>
        /// <param name="floor"></param>
        /// <param name="jumpQueue"></param>
        public void GoToFloor(int floor, bool jumpQueue)
        {
            if (!jumpQueue)
            {
                DestinationQueue.Enqueue(floor);
                NewDestinations.Enqueue(floor);
            }
            else
            {
                var items = DestinationQueue.ToArray();
                DestinationQueue.Clear();
                DestinationQueue.Enqueue(floor);
                foreach (var item in items)
                {
                    DestinationQueue.Enqueue(item);
                }

                JumpQueueDestinations.Enqueue(floor);
            }
        }
예제 #3
0
 /// <summary>
 /// Clear the destination queue and stop the elevator if it is moving.
 /// Note that you normally don't need to stop elevators - it is intended for advanced solutions with in-transit rescheduling logic.
 /// Also, note that the elevator will probably not stop at a floor, so passengers will not get out.
 /// </summary>
 public void Stop()
 {
     DestinationQueue.Clear();
     StopElevator = true;
     IsDestinationQueueModified = true;
 }