From b0f6fd9b57affdadb0568594f5944a99f34c5ef3 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 20 Apr 2020 22:56:00 +0200 Subject: [PATCH] Fix game over bug --- Assets/Scripts/Core/GameController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Core/GameController.cs b/Assets/Scripts/Core/GameController.cs index 8eca3df..e9f6457 100644 --- a/Assets/Scripts/Core/GameController.cs +++ b/Assets/Scripts/Core/GameController.cs @@ -168,15 +168,20 @@ public class GameController : MonoBehaviour Timescale = startingTimescale; Score = startingScore; CurrentMicrogame = null; + gameOverTimer = 0f; // Notify the TimePanel of the starting status OnMicrogameTimeLeftChange?.Invoke(null, null); StartCoroutine("SpinTheWheel"); } + public float gameOverRequiredTime = 4f; + private float gameOverTimer = 0f; + private void Update() { if(GameOver) { - if(Input.anyKeyDown) { + gameOverTimer += Time.unscaledDeltaTime; + if(gameOverTimer >= gameOverRequiredTime && Input.anyKeyDown) { SceneManager.LoadScene("Default"); } }