Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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));
        }