コード例 #1
0
    public void ScoreChecker(int score, int lifes)       // this is called when we replay a game with another life
    {
        if (ScoreManager.instance.getLifes() <= 0)
        {
            // the gameOver() function it is called from the circleController if this variable it's true
            GameObject.FindWithTag("circleController").GetComponent <CircleController> ().setGameOverTrue();
        }
        else if (ScoreManager.instance.getLifes() > 0)
        {
            gameStartedFromMenu = false;
            gameReplayed        = true;

            this.score = score;
            this.lifes = lifes;

            this.timer = CircleController.getTimer();


            /*// activate transparent hearts if you have less than 3 lifes
             * switch (lifes) {
             * case 1:
             *      UIManager.instance.getAnimht2 ().SetBool ("minusLife", true);
             *      goto case 2;
             * case 2 :
             *      UIManager.instance.getAnimht1 ().SetBool ("minusLife", true);
             *      break;
             * } */


            // Reload GAME
            UIManager.instance.replayWithAnotherLife();

            // we take all the data from the other classes when the game is over or it will be restarted so it can be perpetuated to a new life change in the game
        }
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (!circleControllerReference.getGameOverState())
     {
         scoreText.text = ScoreManager.instance.getScore().ToString();
         float t = CircleController.getTimer();
         timerText.text = t > 0 ? (t >= 10 ? ((int)t).ToString() : "0" + (int)t) : "00";
     }
 }