public void addItem(IInventoryItem item) { items.Add(item); item.onPickup(); //broadcast event to the hud if (ItemAdded != null) { ItemAdded.Invoke(this, new InventoryEventArgs(item)); } }
public void addItem(IInventoryItem item) { // Add item to inventory items.Add(item); item.onPickup(); if (ItemAdded != null) { Debug.Log("Inventory addItem"); ItemAdded.Invoke(this, new InventoryEventArgs(item)); } }
public void addItem(IInventoryItem item) { //checking if the item is already in the list prevents the double pick-ups that were occurring Debug.Log("Inventory addItem"); if (!items.Contains(item)) { items.Add(item); item.onPickup(); //broadcast event to the hud if (ItemAdded != null) { ItemAdded.Invoke(this, new InventoryEventArgs(item)); } } }