Created
June 17, 2021 16:23
-
-
Save qqpann/011a011f2adfd8296ff6bbc119ccfcf9 to your computer and use it in GitHub Desktop.
Revisions
-
qqpann created this gist
Jun 17, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ using UnityEngine; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { bool gameHasEnded = false; public float restartDelay = 2f; public void EndGame() { if (gameHasEnded == false) { gameHasEnded = true; Debug.Log("Game over"); Invoke("RestartGame", restartDelay); } } void RestartGame() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }