Implemented basic 60 second timer and game over state

This commit is contained in:
Gregory Campbell
2020-06-07 12:42:36 -04:00
parent 12d81dc324
commit 0002b239fc
+14
View File
@@ -11,7 +11,10 @@ public class GameScript : MonoBehaviour
private bool clickDown = false; private bool clickDown = false;
private bool clicked = false; private bool clicked = false;
private bool gameOver = false;
private int objectsPolished = 0; private int objectsPolished = 0;
private int timeLimit = 60;
private float timer = 0.0f;
private GameObject pickedUpItem; private GameObject pickedUpItem;
// Start is called before the first frame update // Start is called before the first frame update
@@ -29,6 +32,17 @@ public class GameScript : MonoBehaviour
{ {
clickDown = true; clickDown = true;
} }
timer += Time.deltaTime;
float seconds = timeLimit - (timer % 60);
//Debug.Log((int)seconds);
if(seconds < 0 && gameOver == false)
{
//Debug.Log(objectsPolished);
gameOver = true;
}
} }