Пример #1
0
    void PassOrFail()
    {
        if (levelPass && success == false)
        {
            // You succeeded!
            // Show success panel and mark as complete
            gameController.GetComponent <GameController>().passChallenge = true;
            success = true;
            faceController.SetHappyImage(99f);
            StartCoroutine(LevelCompleteCoroutine());
            if (challengeNumber < 36)
            {
                PlayerPrefs.SetInt("Challenge_" + (challengeNumber + 1).ToString(), 1);
            }
            //challengeHighScore = PlayerPrefs.GetFloat("ChallengeScore_" + challengeNumber.ToString());
            Debug.Log("Challenge High Score is: " + challengeHighScore);
            if (gameController.score > challengeHighScore)
            {
                PlayerPrefs.SetFloat("ChallengeScore_" + challengeNumber.ToString(), gameController.score);
            }

            // if score is higher than high score, mark in PlayerPrefs as the new high score
        }
        else if (levelFail && fail == false && gameController.lives > 0)
        {
            // GAME OVER BUDDY!
            // Exit and do NOT mark as complete
            fail = true;
            faceController.SetArghImage(99f);
            if (FistTable.instance.fistSpecial == 17)
            {
                gameController.CalculateFist20BonusCoins();
            }
            gameController.GetComponent <GameController>().savedCoinScore += gameController.GetComponent <GameController>().coinScore;
            gameController.GetComponent <GameController>().bonusCoinScore++;            //Get 1 coin for losing as long as you "tried"
            gameController.GetComponent <GameController>().savedCoinScore += gameController.GetComponent <GameController>().bonusCoinScore;
            PlayerPrefs.SetInt(GamePreferences.CoinScore, gameController.GetComponent <GameController>().savedCoinScore);
            gameOverController.GetComponent <GameOverController>().GameOver();
        }
    }