public void updateScore()
    {
        #region pass score into the final scene and set high score when the score exceeds the current high score
        if (finish.Won)
        {
            //pass the score into the score player prefab
            PlayerPrefabsManager.SetScoreKey(score);

            #region new high score

            //If the score is higher than the high score, se this value as the new high score
            if (score >= PlayerPrefabsManager.GetHighScoreKey())
            {
                PlayerPrefabsManager.SetHighScoreKey(score);
            }
            #endregion new high score

            //transition to the win screen
            levelManager.changeScene("Win");
        }
        #endregion pass score into the final scene and set high score when the score exceeds the current high score
    }
Exemplo n.º 2
0
    void Update()
    {
        #region score, lives and health text
        scoreText.text  = "Score: " + score;
        healthText.text = "Health: " + health;
        liveText.text   = "Lives: " + live;
        #endregion score, lives and health text

        #region pass score into final score and/or high score
        //final score
        if (lifeCount.lives <= 0)
        {
            PlayerPrefabsManager.SetScoreKey(score);

            #region new high score
            // if higher than high score, new high score
            if (score >= PlayerPrefabsManager.GetHighScoreKey())
            {
                PlayerPrefabsManager.SetHighScoreKey(score);
            }
            #endregion new high score
        }
        #endregion pass score into final score and/or high score
    }