Esempio n. 1
0
    private void UpdateScore(int scoreToAdd)
    {
        /*PlayerSettingsScript.PlayerSettings.prevGame.score += scoreToAdd;
         * gameScore.text = PlayerSettingsScript.PlayerSettings.prevGame.score.ToString();
         * if (PlayerSettingsScript.PlayerSettings.prevGame.score >= PlayerSettingsScript.PlayerSettings.HighScores[0])
         * {
         *  PlayerSettingsScript.PlayerSettings.HighScores[0] = PlayerSettingsScript.PlayerSettings.prevGame.score;
         *  HS_TXT.text = PlayerSettingsScript.PlayerSettings.HighScores[0].ToString();
         * }*/
        GameSaveScr gss = GameObject.Find("GameSave").GetComponent <GameSaveScr>();

        //PlayerSettingsScript.PlayerSettings.score += scoreToAdd;
        LocalScore += scoreToAdd;
        //gameScore.text = PlayerSettingsScript.PlayerSettings.score.ToString();
        gameScore.text = LocalScore.ToString();
        //if (PlayerSettingsScript.PlayerSettings.score >= PlayerSettingsScript.PlayerSettings.HighScore1)
        if (LocalScore >= PlayerSettingsScript.PlayerSettings.HighScore1)
        {
            //PlayerSettingsScript.PlayerSettings.HighScore1 = PlayerSettingsScript.PlayerSettings.score;
            //HS_TXT.text = PlayerSettingsScript.PlayerSettings.HighScore1.ToString();
            HS_TXT.text = LocalScore.ToString();
        }
        else
        {
            HS_TXT.text = PlayerSettingsScript.PlayerSettings.HighScore1.ToString();
        }
        //Let's manage the number left here:
        if (scoreToAdd == PowUpSc)
        {
            CS_scriptRef.DeductPU();
        }
        else if (scoreToAdd == CoinSc)
        {
            CS_scriptRef.DeductCoin();
        }
        else
        {
            //ghost or tampered score
        }
        //check for win
        if (CS_scriptRef.LeftoverCPU() == 0)
        {
            //win, stop game, do whatever we need to do to signal the end of the game, save, then load next level.
            CS_scriptRef.OnWin();
        }
    }