コード例 #1
0
        public void Move(int id, CellLocation dst)
        {
            var item = ItemDatabase.Instance().GetItem(id);

            if (item.Moving)
            {
                Console.WriteLine("MOVE: item is already moving, ignoring request");
                return;
            }
            ForkLoader current = item.Place.Rack == Side.Left ? LeftForkLoader : RightForkLoader;

            current.EnqueueUnloadRequest(new UnloadRequest(id, dst.Rack == Side.Left? Item.Destination.Left : Item.Destination.Right, dst));
        }
コード例 #2
0
        public void Unload(int id)
        {
            // TODO: cancel movement
            var item = ItemDatabase.Instance().GetItem(id);

            if (item.Moving)
            {
                item.PendingForOut = true;
                Console.WriteLine("UNLOAD: Item is moving: scheduling unload");
            }
            else if (item.Dest == Item.Destination.Out)
            {
                Console.WriteLine("UNLOAD: Already unloaded");
            }
            else
            {
                ForkLoader current = item.Place.Rack == Side.Left ? LeftForkLoader : RightForkLoader;
                current.EnqueueUnloadRequest(new UnloadRequest(id, Item.Destination.Out));
                Console.WriteLine("UNLOAD: Item is *not* moving: unloading now");
            }
        }