Ejemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Brick")
        {
            LastBrickPosition(collision);
            if (controlClass.GetQtdBlocks() > 1)
            {
                Destroy(collision.gameObject);

                //Score control
                controlClass.Dec_bricks();
                controlClass.AddScore(1);
                controlClass.ChangeUpdatedScore();                      //Set it as true
                //UpdateScoreText();
                Update();

                //Empty block
                activated = true;
            }
            else
            {
                Destroy(collision.gameObject);
                Destroy(gameObject);

                finalScoreText.SetActive(true);
                UpdateScreenScore();

                controlClass.ChangeActiveGame();                 //Not activated
                Update();

                restartButton.SetActive(true);
                exitButton.SetActive(true);
            }
        }
    }