HighScore.Update C# (CSharp) Méthode

Update() public méthode

public Update ( ) : void
Résultat void
    void Update()
    {
        //if the players score on this run is higher than the high score
        currentText.text = currentScore.ToString();
        if(currentScore > highScore)
        {
            //set high score to the players current score
            highScore = currentScore;
            PlayerPrefs.SetInt("HighScore", currentScore);
            scoreText.text = highScore.ToString();

        }
    }

Usage Example

        public override void Update(GameTime gameTime, StateManager screen,
                                    GamePadState gamePadState, MouseState mouseState,
                                    KeyboardState keyState, InputHandler input)
        {
            if (input.KeyboardState.WasKeyPressed(Keys.Escape))
            {
                screen.Pop();
            }

            highScore.Update(gameTime);
        }
All Usage Examples Of HighScore::Update