]> git.cameronkatri.com Git - gmtk-gamejam.git/commitdiff
Merge branch 'master' of git.cameronkatri.com:gmtk-gamejam
authorCarson Katri <carson.katri@gmail.com>
Sun, 13 Jun 2021 05:07:23 +0000 (01:07 -0400)
committerCarson Katri <carson.katri@gmail.com>
Sun, 13 Jun 2021 05:07:23 +0000 (01:07 -0400)
1  2 
Assets/Scripts/Controllers/GameController.cs

index 739f76ca8834a899870dd2a741487cf5e143620d,62bb8490e40b8be0ce4fbbb8d9b87a1fe98ff831..404a755dee7e456a03376e455726bf1768ed701a
@@@ -20,7 -20,7 +20,7 @@@ namespace Controller
      public bool freezeMotion;
  
      private float startTime;
 -    [SerializeField] private float timeLimit;
 +    public static float timeLimit;
      
      /// <summary>
      /// The single ball for the game.
@@@ -37,6 -37,7 +37,7 @@@
  
      [Header("SFX")]
      [SerializeField] public AudioSource dribbleSound;
+     [SerializeField] public AudioSource airhornSound;
  
      [Header("UI")]
      [SerializeField] private Text playerScoreText;
@@@ -66,6 -67,7 +67,7 @@@
        UpdateUI();
      }
  
+     private bool gameover;
      private void UpdateUI()
      {
        playerScoreText.text = $"{player.score}";
        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}");