Sunday, July 24, 2022
HomeGame Developmentc# - My excessive rating retains getting added by my present rating?...

c# – My excessive rating retains getting added by my present rating? The rating is predicated on time like a “survival”


 [SerializeField] GameObject OverScreen;
[SerializeField] Textual content SecondsText;
[SerializeField] Textual content HighScoreText;
[SerializeField] float Rating;
[SerializeField] float highscore;

personal void Begin()
{
    FindObjectOfType<CoreBlock>().OnPlayerDeath += OnGameOver;
    Rating = Time.time;
}

personal void Replace()
{
    if((Rating > highscore))
    PlayerPrefs.SetFloat("Excessive Rating", Rating);
}
void OnGameOver()
{
    OverScreen.SetActive(true);
    SecondsText.textual content = Mathf.RoundToInt(Time.timeSinceLevelLoad).ToString();
    HighScoreText.textual content = highscore.ToString();
}

public void ResetGame()
{
    SceneManager.LoadScene(1);
}

My excessive rating retains getting “added” by my rating. Time.time will maintain ticking up so long as the appliance is operating, so if i have to show the highscore, i’ve to seize the time at gameover. proper? but when so, how? thanks upfront

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments