示例#1
0
 private void OnBallDeath(Ball obj)
 {
     if (BallsManager.Instance.Balls.Count <= 0)
     {
         this.Lives--;
         if (this.Lives < 1)
         {
             // Game over
             // Show Gameover screen
             SoundManager.PlaySound("gameover");
             gameOverScreen.SetActive(true);
         }
         else
         {
             // Reset balls
             // stop game play
             // reload the level
             // invoking the lost live event
             BallsManager.Instance.ResetBalls();
             IsGameStarted = false;
             BricksManager.Instance.LoadLevel(BricksManager.Instance.CurrentLevel);
             OnLiveLost?.Invoke(this.Lives);
         }
     }
 }
    private void OnBallDeath(Ball obj)
    {
        if (BallsManager.Instance.Balls.Count <= 0)
        {
            this.Lives--;

            if (this.Lives < 1)
            {
                OnLiveLost?.Invoke(this.Lives);
                countChance--;

                if (countChance >= 1)
                {
                    gameOverScreen.SetActive(true);
                }
                else
                {
                    gameOverScreen2.SetActive(true);
                }
            }
            else
            {
                OnLiveLost.Invoke(this.Lives);
                BallsManager.Instance.ResetBalls();
                IsGameStarted = false;
            }
        }
    }
 private void RestartGame()
 {
     gameOverScreen.SetActive(false);
     this.Lives = this.currentLives;
     OnLiveLost?.Invoke(this.Lives);
     BallsManager.Instance.ResetBalls();
     IsGameStarted = false;
     BricksManager.Instance.LoadLevel(BricksManager.Instance.CurrentLevel);
 }
示例#4
0
 private void OnBallDeath(Ball obj)
 {
     if (BallsManager.Instance.Balls.Count <= 0)
     {
         this.Lives--;
         if (this.Lives < 1)
         {
             gameOverScreen.SetActive(true);     //show gameover screen
         }
         else
         {
             OnLiveLost?.Invoke(this.Lives);
             BallsManager.Instance.ResetBalls();                                     //reset balls
             IsGameStarted = false;                                                  //stop the game
             BricksManager.Instance.LoadLevel(BricksManager.Instance.CurrentLevel);  //reload the level
         }
     }
 }
示例#5
0
 private void OnBallDeath(Pelota obj)
 {
     if (ballsManagers.Instance.pelotas.Count <= 0)
     {
         this.vidas--;
         if (vidas < 1)
         {
             gameOverScreen.SetActive(true);
         }
         else
         {
             OnLiveLost?.Invoke(this.vidas);
             ballsManagers.Instance.ResetBall();
             IsGameStarted = false;
             BrickManager.Instance.LoadLevel(BrickManager.Instance.CurrentLevel);
         }
     }
 }
示例#6
0
 private void OnBallDeath(Ball obj)
 {
     if (BallsManager.Instance.Balls.Count <= 0)
     {
         this.Lives--;
         if (this.Lives < 1)
         {
             gameOverScreen.SetActive(true);
         }
         else
         {
             OnLiveLost?.Invoke(this.Lives);
             BallsManager.Instance.ResetBalls();
             IsGameStarted = false;
             BrickManager.Instance.LoadLevel(BrickManager.Instance.CurrentLevel);
         }
     }
 }