]> git.cameronkatri.com Git - gmtk-gamejam.git/blobdiff - Assets/Scripts/Controllers/GameController.cs
Airhorn at game end, better dribble, ball hit sound
[gmtk-gamejam.git] / Assets / Scripts / Controllers / GameController.cs
index 4bdae387482415aa91d94d4655e09ec0313f814d..62bb8490e40b8be0ce4fbbb8d9b87a1fe98ff831 100644 (file)
@@ -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}");