public bool freezeMotion;
private float startTime;
- [SerializeField] private float timeLimit;
+ public static float timeLimit;
/// <summary>
/// The single ball for the game.
[Header("SFX")]
[SerializeField] public AudioSource dribbleSound;
+ [SerializeField] public AudioSource airhornSound;
[Header("UI")]
[SerializeField] private Text playerScoreText;
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}");