fixed highscore not loading

This commit is contained in:
nexovec 2022-01-30 14:45:57 +01:00
parent a0a2ab3983
commit 81cce75bea

View File

@ -16,7 +16,7 @@ public class UiController : MonoBehaviour
public static bool isInMenu = true; public static bool isInMenu = true;
public static float distance = 0; public static float distance = 0;
public static int highScore = 0; public static float highScore = 0;
private float oldDistance = 0.0f; private float oldDistance = 0.0f;
// Start is called before the first frame update // Start is called before the first frame update
@ -71,10 +71,14 @@ public class UiController : MonoBehaviour
if (oldDistance < distance) if (oldDistance < distance)
{ {
uiDistance.text = "Distance : " + distance.ToString("0"); uiDistance.text = "Distance : " + distance.ToString("0");
uiHighScore.text = "HighScore : " + UiController.highScore.ToString("0");
oldDistance = distance; oldDistance = distance;
if (distance > highScore)
{
highScore = distance;
} }
} }
uiHighScore.text = "HighScore : " + UiController.highScore.ToString("0");
}
public void FixedUpdate(){ public void FixedUpdate(){
this.menuCamera.transform.position = this.menuCamera.transform.position + Vector3.forward * 0.05f; this.menuCamera.transform.position = this.menuCamera.transform.position + Vector3.forward * 0.05f;
} }