public bool AddItemToInventory(Item_SO item) { bool itemAdded = false; if (item.isStackable) { foreach (InventorySlot slot in inventorySlots) { var tmp = slot.GetComponent <InventorySlot>(); var itemTmp = tmp.GetItem(); if (itemTmp != null && itemTmp.isStackable && itemTmp.stackSize < item.maxStackSize) { tmp.AddItemToSlot(item); itemTmp.stackSize++; Debug.Log("[Inventory Manager] Item added to the stack of " + item.itemName); itemAdded = true; break; } } if (itemAdded) { if (onChangedItemCall != null) { onChangedItemCall.Invoke(); } return(true); } } if (emptySlots > 0) { return(AddItem(item)); } else { Debug.Log("[Inventory Manager] inventory is full"); return(false); } }
/// <summary> /// Add an item to the temporary inventory /// </summary> public void AddItemToTemp(Item_SO _item) { tempItems.Add(_item.id); }
//Equip the _active item in the character's bodypart slot matching the item's public void EquipItem(Item_SO item) { GameObject characterSlot = GetGameobjectForBodypart(item._bodypart); characterSlot.GetComponent <SpriteRenderer>().sprite = item._illustration; }
public void UpdateItemDescription(Item_SO item) { _itemDescription.GetComponent <ItemDescription>().DisplayItemDescription(item); }
public void DisplayItem(Item_SO item) { _activeItem = item; UpdateItemDescription(item); }
/// <summary> /// Unequip Item /// </summary> public void Unequip(Item_SO item) { equipmentItems.Remove(item.id); }
/// <summary> /// Equip Item /// </summary> public void EquipItem(Item_SO item) { equipmentItems.Add(item.id); }
//button public void EquipItem(Item_SO _item) { MainBaseManager.Instance.inventory.EquipItem(_item); }
public BagSlot(Item_SO _item, int _amount) { item = _item; amount = _amount; }
public void ClearHand() { Held_Item = null; ClearImage(); }
public void EquipItem(Item_SO item) { }
public void AddItem(Item_SO item) { }
public void RemoveItem(Item_SO item) { }
public void SetType(Item_SO newItem) { item = newItem; cubeRend.material.color = item.color; letter.text = item.letter; }