Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
    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;
            }
        }
    }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 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
         }
     }
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
         }
     }
 }