Exemplo n.º 1
0
    public void OnTriggerEnter2D(Collider2D coll)
    {
        AudioSource audio = GetComponent <AudioSource>();

        if (coll.gameObject.tag == lixeira.gameObject.tag)
        {
            scoreManager.AddGameScore(10);
            audio.clip = sndMatch;
            audio.Play();

            if (scoreManager.GetGameScore() >= bonusManager.GetScoreBonusTarget())
            {
                timeManager.AddGameTime();
                bonusManager.AddScoreBonusTarget();
                audio.clip = sndBonus;
                audio.Play();
            }
        }
        else
        {
            timeManager.LossGameTime(5);
            audio.clip = sndError;
            audio.Play();
        }

        scoreManager.SetGameScoreText();

        Destroy(coll.gameObject);
    }