public void Buy(Item item) { if (player.coins >= item.value) // if the player has enough coins to buy { if (item.isUpgrade()) // if its a upgrade just use right away { Debug.Log("is an upgrade"); item.Use(); playerCoins.MinusCoins(item.value); } else // else its a consumable so add to player inventory { Debug.Log("Item is: " + item); player.inventory.AddItem(item); playerCoins.MinusCoins(item.value); } } }