private void OnItemDropped(ISlot from, List <GameObject> objectsHit)
 {
     // Outside inventory
     if (objectsHit.Count == 0)
     {
         OnItemRemove?.Invoke(from.StoredItem, from.SlotCount);
         from.DropAll();
         return;
     }
     for (int i = 0, n = objectsHit.Count; i < n; i++)
     {
         // Dropped on the inventory grid
         if (objectsHit[i].TryGetComponent(out IInventorySystem _))
         {
             return;
         }
         // Dropped on inventory slot
         if (objectsHit[i].TryGetComponent(out ISlot to))
         {
             MoveItem(from, to);
             return;
         }
     }
     // Outside inventory
     from.DropAll();
     OnItemRemove?.Invoke(from.StoredItem, from.SlotCount);
 }
        private void SwapSlots(ISlot fromSlot, ISlot toSlot)
        {
            ItemStats item1   = fromSlot.StoredItem;
            int       amount1 = fromSlot.SlotCount;
            ItemStats item2   = toSlot.StoredItem;
            int       amount2 = toSlot.SlotCount;

            fromSlot.DropAll();
            fromSlot.AddAll(item2, amount2);
            toSlot.DropAll();
            toSlot.AddAll(item1, amount1);
        }
 private void MoveToEmptySlot(ISlot fromSlot, ISlot toSlot)
 {
     toSlot.AddAll(fromSlot.StoredItem, fromSlot.SlotCount);
     fromSlot.DropAll();
 }