Exemple #1
0
    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);
        }
    }
Exemple #2
0
 public void AddLife(int amount)
 {
     playerLife.ChangeLife(amount);
     playerInventory.AddMoney(-addLifeCost);
 }