fix: reset score, only show in free flight

This commit is contained in:
Jakob Feldmann 2024-05-08 18:56:26 +02:00
parent d2c59a32eb
commit d4829e572b
3 changed files with 11 additions and 1 deletions

View File

@ -320,6 +320,7 @@ namespace Managers
public void ResetMatch() public void ResetMatch()
{ {
CurrentMatchResult = new GameResult(); CurrentMatchResult = new GameResult();
StatisticsManager.G.ResetScore();
ResetMatchCharacters(); ResetMatchCharacters();
SetupMatchPlayerStatistics(); SetupMatchPlayerStatistics();
} }

View File

@ -31,5 +31,11 @@ namespace Managers
FreeFlightScore += score; FreeFlightScore += score;
UIManager.G.hUD.UpdateScore(FreeFlightScore); UIManager.G.hUD.UpdateScore(FreeFlightScore);
} }
public void ResetScore()
{
FreeFlightScore = 0;
UIManager.G.hUD.UpdateScore(FreeFlightScore);
}
} }
} }

View File

@ -1,3 +1,5 @@
using FishNet.Managing.Scened;
using Managers;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
@ -36,7 +38,8 @@ public class HUD : MonoBehaviour
public void UpdateScore(int newScore) public void UpdateScore(int newScore)
{ {
if (!score.enabled) if (!score.enabled
&& GameManager.G.CurrentScene == SceneEnum.FreeFlyArena)
score.enabled = true; score.enabled = true;
score.text = $"Score: {newScore}"; score.text = $"Score: {newScore}";