aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Assets/Scripts/Controllers/GameController.cs
diff options
context:
space:
mode:
authorCarson Katri <carson.katri@gmail.com>2021-06-13 01:07:23 -0400
committerCarson Katri <carson.katri@gmail.com>2021-06-13 01:07:23 -0400
commitfb098531f41a3314ac61f1e4c808625c679c4653 (patch)
tree8cb1e06196893292166b2908b6112d921852d9d6 /Assets/Scripts/Controllers/GameController.cs
parentf2ea922dfd57bdbd64a0091eab3b97f936281343 (diff)
parent853b013d3c0127fb2c04a7cfeab23c77d52fc51f (diff)
downloadgmtk-gamejam-fb098531f41a3314ac61f1e4c808625c679c4653.tar.gz
gmtk-gamejam-fb098531f41a3314ac61f1e4c808625c679c4653.tar.zst
gmtk-gamejam-fb098531f41a3314ac61f1e4c808625c679c4653.zip
Merge branch 'master' of git.cameronkatri.com:gmtk-gamejam
Diffstat (limited to 'Assets/Scripts/Controllers/GameController.cs')
-rw-r--r--Assets/Scripts/Controllers/GameController.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Assets/Scripts/Controllers/GameController.cs b/Assets/Scripts/Controllers/GameController.cs
index 739f76c..404a755 100644
--- a/Assets/Scripts/Controllers/GameController.cs
+++ b/Assets/Scripts/Controllers/GameController.cs
@@ -37,6 +37,7 @@ namespace Controllers
[Header("SFX")]
[SerializeField] public AudioSource dribbleSound;
+ [SerializeField] public AudioSource airhornSound;
[Header("UI")]
[SerializeField] private Text playerScoreText;
@@ -66,6 +67,7 @@ namespace Controllers
UpdateUI();
}
+ private bool gameover;
private void UpdateUI()
{
playerScoreText.text = $"{player.score}";
@@ -75,8 +77,10 @@ namespace Controllers
var remaining = TimeSpan.FromSeconds(Mathf.Clamp(remainingRaw, 0, float.MaxValue));
timerText.text = $"{remaining.Minutes:00}:{remaining.Seconds:00}";
- if (remainingRaw <= 0)
+ if (remainingRaw <= 0 && !gameover)
{
+ gameover = true;
+ airhornSound.Play();
var outcome = player.score == enemy.score ? "TIE GAME" : player.score < enemy.score ? "AWAY TEAM WINS" : "HOME TEAM WINS";
ShowModal($"{outcome}\n{player.score}-{enemy.score}");