Ejemplo n.º 1
0
        public bool TrySwap(Slot otherSlot)
        {
            if (IsEmpty && !otherSlot.IsEmpty)
            {
                Store(otherSlot._object);
                return(true);
            }
            else if (otherSlot.IsEmpty && !IsEmpty)
            {
                otherSlot.Store(_object);
                return(true);
            }
            else if (!otherSlot.IsEmpty && !otherSlot.IsEmpty)
            {
                InventoryObject tmp = _object;
                Store(otherSlot._object);
                otherSlot.Store(tmp);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void OnInventoryObjectDropped(Slot slot)
        {
            if (_context.DraggedObject == null)
            {
                return;
            }

            if (slot.IsEmpty)
            {
                // TODO create a reference

                slot.Store(_context.DraggedObject);

                //_inventory.Clear(_context.DraggedObjectSource._index);
                //_inventory.Store(slot._index, _context.DraggedObject._item);

                //SelectSlot(slot);
            }
        }
Ejemplo n.º 3
0
 public virtual void Move(Slot slot)
 {
     OnMovedHandler?.Invoke(this);
     _slot = slot;
     slot.Store(this);
 }