public void CheckHighscore() { float highscore = ScoreSavingSysytem.ReadHighscore(); if (highscore < 0f) { textField.text = "Highscore:\nNo games finished yet!"; } else { string minutes = ((int)highscore / 60).ToString(); string seconds = (highscore % 60).ToString("00"); string miliseconds = ((highscore * 100) % 100).ToString("00"); textField.text = "Highscore:\n" + minutes + ":" + seconds + ":" + miliseconds; } }
public void EndGameActions() { tickTime = false; gameOverMessage.GetComponent <Text>().text += "\n" + minutes + ":" + seconds + ":" + miliseconds; coroutineRunner.StartCoroutine(ActivateEndButtonDelayed()); float latestTime = time; if (ScoreSavingSysytem.ReadHighscore() < latestTime) { ScoreSavingSysytem.SaveHighscore(latestTime); gameOverMessage.GetComponent <Text>().text += "\nNew highscore!"; } else { gameOverMessage.GetComponent <Text>().text += "\nBetter luck next time!"; } gameOverMessage.SetActive(true); }
void ClickActionReset() { ScoreSavingSysytem.SaveHighscore(-1f); highscoreDisplay.GetComponent <HighscoreDisplay>().CheckHighscore(); }