Пример #1
0
 public void UseItemInv(INV_InventoryItem _item)
 {
     if (!CheckID(_item.ID))
     {
         return;
     }
     GetFromID(_item.ID).RemoveStack();
     if (_item.Quantity <= 0)
     {
         playerInventory.Remove(_item.ID);
     }
     OnRefreshInventory?.Invoke(playerInventory);
 }
Пример #2
0
 public void SetData(INV_InventoryItem _item)
 {
     if (!IsValid)
     {
         return;
     }
     if (!_item)
     {
         return;
     }
     itemStored        = _item;
     icon.sprite       = _item.Icon;
     textQuantity.text = $"x{Quantity}";
 }
Пример #3
0
 public void AddInventory(INV_InventoryItem _item)
 {
     if (!_item)
     {
         return;
     }
     _item.OnUseItem = UseItemInv;
     if (!CheckID(_item.ID))
     {
         playerInventory.Add(_item.ID, _item);
     }
     else
     {
         GetFromID(_item.ID).AddStack();
     }
     OnRefreshInventory?.Invoke(playerInventory);
 }
Пример #4
0
    public void AddItem(INV_InventoryItemComponent _itemToAdd)
    {
        INV_InventoryItem _item = INV_InventoryManager.Instance.GetItem(_itemToAdd.Item.ID);

        AddInventory(_item);
    }