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.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Assets/Scripts/GameControl.cs b/Assets/Scripts/GameControl.cs
index afd79b7..77f58d7 100644
--- a/Assets/Scripts/GameControl.cs
+++ b/Assets/Scripts/GameControl.cs
@@ -2,14 +2,18 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
+using UnityEngine.UI;
public class GameControl : MonoBehaviour {
public static GameControl instance;
public GameObject gameOverText;
+ public Text scoreText;
public bool gameOver = false;
public float scrollSpeed = -1.5f;
+ private int score = 0;
+
// Use this for initialization
void Awake ()
{
@@ -31,6 +35,16 @@ public class GameControl : MonoBehaviour {
}
}
+ public void BirdScored()
+ {
+ if (gameOver)
+ {
+ return;
+ }
+ score++;
+ scoreText.text = "Score: " + score.ToString();
+ }
+
public void BirdDied()
{
gameOverText.SetActive(true);