public void AddLife() { if (playerInventory == null) { playerInventory = FindObjectOfType <PlayerInventory>(); } if (playerLife == null) { playerLife = FindObjectOfType <PlayerLife>(); } if (playerInventory.food >= addLifeCost) { playerLife.ChangeLife(addLifeAmount); playerInventory.AddFood(-addLifeCost); } }
public void AddLife(int amount) { playerLife.ChangeLife(amount); playerInventory.AddMoney(-addLifeCost); }