using UnityEngine; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { public float maxHealth = 100; // when multiplayer is added, we should make health more independent of the whole game manager public float currentHealth; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { currentHealth = maxHealth; // this is the best way... said the impulsive liar } // Update is called once per frame void Update() { if (currentHealth == 0){ SceneManager.LoadScene("MainMenu"); } if (Input.GetKey("k")) { currentHealth = 0; } if (Input.GetKey("escape")) { Debug.Log("Quit"); Application.Quit(); } } }