public void TakeItem(InventoryData inventory, Item item)
        {
            if (item != null && !character.IsDoingAction() && inventory.CanTakeItem(item.data.id, item.quantity))
            {
                character.FaceTorward(item.transform.position);

                if (onTakeItem != null)
                {
                    onTakeItem.Invoke(item);
                }

                character.TriggerAction(0.4f, () =>
                {
                    //Make sure wasnt destroyed during the 0.4 sec
                    if (item != null && inventory.CanTakeItem(item.data.id, item.quantity))
                    {
                        PlayerData pdata             = PlayerData.Get();
                        DroppedItemData dropped_item = pdata.GetDroppedItem(item.GetUID());
                        float durability             = dropped_item != null ? dropped_item.durability : item.data.durability;
                        int slot = inventory.AddItem(item.data.id, item.quantity, durability, item.GetUID()); //Add to inventory

                        ItemTakeFX.DoTakeFX(item.transform.position, item.data, inventory.type, slot);

                        item.TakeItem(); //Destroy item
                    }
                });
            }
        }
        public void AutoTakeItem(InventoryData inventory, Item item)
        {
            if (item != null && !character.IsDoingAction() && inventory.CanTakeItem(item.data.id, item.quantity))
            {
                PlayerData      pdata        = PlayerData.Get();
                DroppedItemData dropped_item = pdata.GetDroppedItem(item.GetUID());
                float           durability   = dropped_item != null ? dropped_item.durability : item.data.durability;
                int             slot         = inventory.AddItem(item.data.id, item.quantity, durability, item.GetUID()); //Add to inventory

                ItemTakeFX.DoTakeFX(item.transform.position, item.data, inventory.type, slot);

                item.TakeItem(); //Destroy item
            }
        }
 public void GainItem(InventoryData inventory, ItemData item, int quantity, Vector3 source_pos)
 {
     if (item != null)
     {
         if (inventory.CanTakeItem(item.id, quantity))
         {
             if (inventory.type == InventoryType.Equipment)
             {
                 EquipData.EquipItem(item.equip_slot, item.id, item.durability, UniqueID.GenerateUniqueID());
                 ItemTakeFX.DoTakeFX(source_pos, item, inventory.type, (int)item.equip_slot);
             }
             else
             {
                 int islot = inventory.AddItem(item.id, quantity, item.durability, UniqueID.GenerateUniqueID());
                 ItemTakeFX.DoTakeFX(source_pos, item, inventory.type, islot);
             }
         }
         else
         {
             Item.Create(item, character.GetPosition(), quantity);
         }
     }
 }