public void OnPositionSelection(Vector3 position, Vector3?facingDirection) { if (!Input.GetKey(KeyCode.LeftShift)) { DestinationQueue.Clear(); } DestinationQueue.Add(position); DestinationFacingDirection = facingDirection; }
public virtual async Task ProcessLogsAsync(params FilterLog[] eventLogs) { foreach (var eventLog in eventLogs) { if (Predicate(eventLog)) { await DestinationQueue.AddMessageAsync(Mapper?.Invoke(eventLog) ?? eventLog).ConfigureAwait(false); } } }
/// <summary> /// Checks the destination queue for any new destinations to go to. /// Note that you only need to call this if you modify the destination queue explicitly. /// </summary> public void CheckDestinationQueue() { if (DestinationQueue.Count > 0) { var nextFloor = DestinationQueue.Dequeue(); GoToFloor(nextFloor); } else { OnIdle(); } }
public override async Task ProcessLogsAsync(params FilterLog[] eventLogs) { var decoded = eventLogs.DecodeAllEventsIgnoringIndexMisMatches <TEventDto>(); foreach (var eventLog in decoded) { if (!Predicate(eventLog)) { continue; } await DestinationQueue.AddMessageAsync(Mapper?.Invoke(eventLog) ?? eventLog); } }
/// <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); } }
/// <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; }