Ejemplo n.º 1
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (collision.gameObject.GetComponent <Ball>())
            {
                if (gameMode.GetBallsCount() <= 1)
                {
                    playerStats.ReduceLife();

                    if (playerStats.GetLivesLeft() <= 0)
                    {
                        // Destroy(playerStats);
                        SceneManager.LoadScene("Game Over");
                        // playerStats.Reset();
                    }
                    else
                    {
                        gameMode.hasStarted = false;
                        gameMode.SpawnBall();
                    }
                }

                Destroy(collision.gameObject);
                gameMode.RemoveBall();
            }
        }
Ejemplo n.º 2
0
        private void Start()
        {
            playerStatsHandler = FindObjectOfType <PlayerStatsHandler>();

            playerScore.text = playerStatsHandler.GetScore().ToString();
            livesText.text   = playerStatsHandler.GetLivesLeft().ToString();
        }
Ejemplo n.º 3
0
 void Update()
 {
     playerScore.text = playerStatsHandler.GetScore().ToString();
     livesText.text   = playerStatsHandler.GetLivesLeft().ToString();
 }