public void AddArmor() { if (playerInventory == null) { playerInventory = FindObjectOfType <PlayerInventory>(); } if (playerLife == null) { playerLife = FindObjectOfType <PlayerLife>(); } if (playerInventory.scrap >= addArmorCost) { playerLife.IncreaseArmor(addArmorAmount); playerInventory.AddScrap(-addArmorCost); } }
// Insert in these three function the scrap cost public void AddArmor(int amount) { playerLife.IncreaseArmor(amount, true); playerInventory.AddMoney(-addArmorCost); }