private void PassQueuedBaggage(IChainLink gate) { var queue = _gateQueues[gate]; if (!queue.Any() || gate.Status != NodeState.Free) { return; } gate.PassBaggage(queue.Dequeue()); }
private void PassOrEnqueueBaggage(IChainLink gate, IBaggage bag) { bag.TransportationStartTime = TimerService.GetTicksSinceSimulationStart(); bag.TransporterId = "Queue AA"; if (gate.Status == NodeState.Free) { gate.PassBaggage(bag); } else { if (gate.OnStatusChangedToFree == null) { gate.OnStatusChangedToFree += () => { PassQueuedBaggage(gate); } } ; _gateQueues[gate].Enqueue(bag); } }