1
Fork 0
mirror of https://github.com/Steffo99/keep-everything-alive.git synced 2024-11-25 02:34:18 +00:00

Fix game over bug

This commit is contained in:
Steffo 2020-04-20 22:56:00 +02:00
parent 77793bdd9a
commit b0f6fd9b57

View file

@ -168,15 +168,20 @@ public class GameController : MonoBehaviour
Timescale = startingTimescale; Timescale = startingTimescale;
Score = startingScore; Score = startingScore;
CurrentMicrogame = null; CurrentMicrogame = null;
gameOverTimer = 0f;
// Notify the TimePanel of the starting status // Notify the TimePanel of the starting status
OnMicrogameTimeLeftChange?.Invoke(null, null); OnMicrogameTimeLeftChange?.Invoke(null, null);
StartCoroutine("SpinTheWheel"); StartCoroutine("SpinTheWheel");
} }
public float gameOverRequiredTime = 4f;
private float gameOverTimer = 0f;
private void Update() { private void Update() {
if(GameOver) { if(GameOver) {
if(Input.anyKeyDown) { gameOverTimer += Time.unscaledDeltaTime;
if(gameOverTimer >= gameOverRequiredTime && Input.anyKeyDown) {
SceneManager.LoadScene("Default"); SceneManager.LoadScene("Default");
} }
} }