diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index c64408f..2018369 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -21,6 +21,8 @@ public class PlayerController : OrbitalPositionBehaviour protected override void OnStart() { s_Instance = this; + s_HighScore = Mathf.Max(s_HighScore, PlayerPrefs.GetInt("HighScore", 0)); + Debug.Log($"Loaded high score of [{s_HighScore}]"); GlobalOrbitalPositionManager.SetPlayer(m_OrbitalPosition); @@ -33,6 +35,8 @@ public class PlayerController : OrbitalPositionBehaviour m_ScoreText.text = s_PlayerScore.ToString(); if (s_PlayerScore > s_HighScore) m_ScoreText.color = Color.yellow; + else + m_ScoreText.color = Color.white; if (GlobalInput.IsScreenClicked && GlobalOrbitalPositionManager.AllowPlayerInput) { @@ -65,6 +69,7 @@ public class PlayerController : OrbitalPositionBehaviour m_Renderer.material.color = Color.green; s_HighScore = Math.Max(s_HighScore, s_PlayerScore); + PlayerPrefs.SetInt("HighScore", s_HighScore); s_PlayerScore = 0; }