From 0002b239fcf3bb341f236c3ad3c03924c267bf18 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sun, 7 Jun 2020 12:42:36 -0400 Subject: [PATCH] Implemented basic 60 second timer and game over state --- Assets/Scripts/GameScript.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Assets/Scripts/GameScript.cs b/Assets/Scripts/GameScript.cs index e3006a5..f005bb3 100644 --- a/Assets/Scripts/GameScript.cs +++ b/Assets/Scripts/GameScript.cs @@ -11,7 +11,10 @@ public class GameScript : MonoBehaviour private bool clickDown = false; private bool clicked = false; + private bool gameOver = false; private int objectsPolished = 0; + private int timeLimit = 60; + private float timer = 0.0f; private GameObject pickedUpItem; // Start is called before the first frame update @@ -29,6 +32,17 @@ public class GameScript : MonoBehaviour { clickDown = true; } + + timer += Time.deltaTime; + float seconds = timeLimit - (timer % 60); + + //Debug.Log((int)seconds); + + if(seconds < 0 && gameOver == false) + { + //Debug.Log(objectsPolished); + gameOver = true; + } }