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); }
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); } }
public virtual void Move(Slot slot) { OnMovedHandler?.Invoke(this); _slot = slot; slot.Store(this); }