summaryrefslogtreecommitdiff
path: root/Assets/Scripts/GameControl.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/GameControl.cs')
-rw-r--r--Assets/Scripts/GameControl.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/Assets/Scripts/GameControl.cs b/Assets/Scripts/GameControl.cs
new file mode 100644
index 0000000..afd79b7
--- /dev/null
+++ b/Assets/Scripts/GameControl.cs
@@ -0,0 +1,39 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+
+public class GameControl : MonoBehaviour {
+
+ public static GameControl instance;
+ public GameObject gameOverText;
+ public bool gameOver = false;
+ public float scrollSpeed = -1.5f;
+
+ // Use this for initialization
+ void Awake ()
+ {
+ if (instance == null)
+ {
+ instance = this;
+ } else if (instance != this)
+ {
+ Destroy(gameObject);
+ }
+ }
+
+ // Update is called once per frame
+ void Update ()
+ {
+ if (gameOver == true && Input.GetMouseButtonDown(0)) // True and Leftclick
+ {
+ SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); // Reload currently active scene
+ }
+ }
+
+ public void BirdDied()
+ {
+ gameOverText.SetActive(true);
+ gameOver = true;
+ }
+}