Implemented basic 60 second timer and game over state
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user