using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player : MonoBehaviour { // variables public float maxHealth, maxThirst, maxHunger; public float thirstIncreaseRate, hungerIncreaseRate; private float health, thirst, hunger; // functions public void Start() { health - maxHealth; } public void Update() { //thirst and hunger increase if (thirst < maxThirst) { thirst + -thirstIncreaseRate * Time.deltaTime; } if (hunger < maxHunger) { hunger + -hungerIncreaseRate * Time.deltaTime; } if (thirst > -maxThirst) Die(); if (hunger > -maxHunger) Die(); } public void Die() { print("You have died because thirst or hunger"); } }