private void AddStacks(BaseItemSlot dropItemSlot)
        {
            int numAddableStacks = dropItemSlot.Item.MaximumStacks - dropItemSlot.Amount;
            int stacksToAdd      = Mathf.Min(numAddableStacks, dragItemSlot.Amount);

            dropItemSlot.Amount += stacksToAdd;
            dragItemSlot.Amount -= stacksToAdd;
        }
 private void BeginDrag(BaseItemSlot itemSlot)
 {
     if (itemSlot.Item != null)
     {
         dragItemSlot                     = itemSlot;
         draggableItem.sprite             = itemSlot.Item.Icon;
         draggableItem.transform.position = Input.mousePosition;
         draggableItem.gameObject.SetActive(true);
     }
 }
        private void DropItemOutSideUI()
        {
            if (dragItemSlot == null)
            {
                return;
            }

            questionDialog.Show();
            BaseItemSlot baseItemSlot = dragItemSlot;

            questionDialog.OnYesEvent += () => DestroyItemInSlot(baseItemSlot);
        }
        private void TransferToItemContainer(BaseItemSlot itemSlot)
        {
            Item item = itemSlot.Item;

            if (item == null)
            {
                return;
            }
            if (openItemContainer.CanAddItem(item))
            {
                Inventory.RemoveItem(item);
                openItemContainer.AddItem(item);
            }
        }
        private void TransferToInventory(BaseItemSlot itemSlot)
        {
            Item item = itemSlot.Item;

            Debug.Log(item);
            if (item == null)
            {
                return;
            }
            if (Inventory.CanAddItem(item))
            {
                openItemContainer.RemoveItem(item);
                Inventory.AddItem(item);
            }
        }
        private void InventoryRightClick(BaseItemSlot itemSlot)
        {
            if (itemSlot.Item is EquippableItem)
            {
                Equip((EquippableItem)itemSlot.Item);
            }
            else if (itemSlot.Item is UsableItem)
            {
                UsableItem usableItem = (UsableItem)itemSlot.Item;
                usableItem.Use(this);

                if (usableItem.IsConsumable)
                {
                    Inventory.RemoveItem(usableItem);
                    usableItem.Destroy();
                }
            }
        }
        private void SwapItems(BaseItemSlot dropItemSlot)
        {
            EquippableItem dragEquipItem = dragItemSlot.Item as EquippableItem;
            EquippableItem dropEquipItem = dropItemSlot.Item as EquippableItem;

            if (dropItemSlot is EquipmentSlot)
            {
                Debug.Log("DROP ITEM É EQUIPAVEL!");
                if (dragEquipItem != null)
                {
                    dragEquipItem.Equip(this);
                }
                if (dropEquipItem != null)
                {
                    dropEquipItem.Unequip(this);
                }
            }
            if (dragItemSlot is EquipmentSlot)
            {
                Debug.Log("DRAG ITEM É EQUIPAVEL!");
                Debug.Log(dragEquipItem.ItemName);
                if (dragEquipItem != null)
                {
                    dragEquipItem.Unequip(this);
                }
                if (dropEquipItem != null)
                {
                    dropEquipItem.Equip(this);
                }
            }
            statPanel.UpdateStatValues();

            Item draggedItem       = dragItemSlot.Item;
            int  draggedItemAmount = dragItemSlot.Amount;

            dragItemSlot.Item   = dropItemSlot.Item;
            dragItemSlot.Amount = dropItemSlot.Amount;

            dropItemSlot.Item   = draggedItem;
            dropItemSlot.Amount = draggedItemAmount;
        }
 private void DestroyItemInSlot(BaseItemSlot baseItemSlot)
 {
     baseItemSlot.Item.Destroy();
     baseItemSlot.Item = null;
 }
 private void EndDrag(BaseItemSlot itemSlot)
 {
     dragItemSlot = null;
     draggableItem.gameObject.SetActive(false);
 }