public void OnEnterNewHighScore() { string initials = GetComponent <InputField>().text; if (initials == null || initials.Length == 0) { AccessDeniedSound.Play(); return; } HUDInventoryAndScoreController scoreController = (HUDInventoryAndScoreController)Object.FindObjectOfType(typeof(HUDInventoryAndScoreController)); int score = scoreController.GetCurrentScore(); HighScoreUtils.AddHighScore(initials, score); SceneManager.LoadScene("HighScoreScene"); }
private bool IsNewHighScore() { HUDInventoryAndScoreController scoreController = (HUDInventoryAndScoreController)Object.FindObjectOfType(typeof(HUDInventoryAndScoreController)); int score = scoreController.GetCurrentScore(); SortedList <int, HighScore> highScores = HighScoreUtils.GetHighScores(); if (highScores.Count < 10) { return(true); } foreach (HighScore highScore in highScores.Values) { if (score >= highScore.Score) { return(true); } } return(false); }