Inventory.ConsumeItem C# (CSharp) Method

ConsumeItem() public method

public ConsumeItem ( Item, item ) : void
item Item,
return void
    public void ConsumeItem(Item item)
    {
        if (ItemConsumed != null)
            ItemConsumed(item);
    }

Usage Example

Example #1
0
 public void OnPointerDown(PointerEventData data)
 {
     if (inventory != null)
     {
         if (item.Type < 6)
         { //item is equippable
             string s = Enum.GetName(typeof(ItemType), item.Type);
             if (inventory.equipSlots[item.Type] == null)
             {
                 GameObject inventoryItem = this.gameObject;
                 inventory.equipSlots[item.Type] = inventoryItem;
                 GameObject charSlot = inventory.charPanel.transform.GetChild(0).GetChild(item.Type).gameObject;
                 inventoryItem.transform.SetParent(charSlot.transform);
                 inventoryItem.GetComponent <RectTransform>().localPosition = Vector3.zero;
                 Debug.Log("Item Equipped");
             }
             inventory.EquipItem(item);
         }
         if (item.Type == 6)
         { //item is consumable
             int amount;
             inventory.ConsumeItem(item);
             amount = inventory.RemoveItem(item);
             if (amount == 0)
             {
                 Destroy(gameObject);
             }
         }
     }
 }
All Usage Examples Of Inventory::ConsumeItem