protected virtual void DoDropoff(StackingEvent dropoff) { switch (dropoff) { case BlockEvent b: if (Location.FreeHeight == 0) { return; } Location.Dropoff(b.Block); break; case StackEvent s: if (Location.FreeHeight < s.Size) { return; } Location.Dropoff(s.Stack); break; default: throw new InvalidOperationException($"Unknown event type {dropoff?.GetType()}."); } DropoffWaitingTime?.Add(World.Environment.ToDouble(World.Environment.Now - dropoff.Time)); dropoff.Succeed(); }
protected virtual void DoPickup(StackingEvent @event) { switch (@event) { case BlockEvent b: if (Location.Height == 0) { return; } @event.Succeed(Location.Pickup()); break; case StackEvent s: if (Location.Height < s.Size) { return; } @event.Succeed(Location.Pickup(s.Size)); break; default: throw new InvalidOperationException($"Unknown event type {@event?.GetType()}."); } PickupWaitingTime?.Add(World.Environment.ToDouble(World.Environment.Now - @event.Time)); }