Example #1
0
    /**
     * Metodo para tratar de colisoes com objetos Trigger
     * */
    void OnTriggerEnter2D(Collider2D outro)
    {
        if (outro.tag == "redBallon" || outro.tag == "shuriBallon")
        {
            scoreController.total++;
            nrCombo++;
            /*Destroi Objeto Balao*/
            Destroy(outro.gameObject);
            /*Toca Som Espada*/
            playSoundSword();
            /*Instancia Texto Açao*/
            exibeTextoGood();
            exibeAnimAtk();
            //Instantiate(textoGood, transform.position, Quaternion.identity);
        }
        else if (outro.tag == "blueBallon")
        {
            /*Destroi Balao Vitima e reduz HP*/
            roomController.reduzHP();
            nrCombo = 0;
            Destroy(outro.gameObject);
            playSoundBallonPop();
            /*Instancia Texto Açao*/
            exibeTextoBad();
        }
        else if (outro.tag == "shuriTrap")
        {
            /*Destroi Balao Vitima e reduz HP*/
            roomController.reduzHP(10f);
            nrCombo = 0;
            playSoundBallonPop();
            /*Instancia Texto Açao*/
            exibeTextoBad();
            Destroy(outro.gameObject);
        }
        else if (outro.tag == "bamboo")
        {
            /*Destroi Balao Vitima e reduz HP*/
            roomController.reduzHP(20f);
            nrCombo = 0;
            playSoundBallonPop();
            /*Instancia Texto Açao*/
            exibeTextoBad();
        }
        else if (outro.tag == "blade")
        {
            /*Destroi Balao Vitima e reduz HP*/
            roomController.reduzHP(25f);
            nrCombo = 0;
            playSoundBallonPop();
            /*Instancia Texto Açao*/
            exibeTextoBad();
        }
        else if (outro.tag == "cheese")
        {
            /*Acrescenta ao Score, Som, e Destroy Cheese*/
            scoreController.totalCheese++;
            roomController.maisHpUp();
            playSoundCheeseGet();
            Destroy(outro.gameObject);
        }
        else if (outro.tag == "dragon")
        {
            /*Acrescenta ao Score, Som, e Destroy Cheese*/
            roomController.reduzHP(25f);
            nrCombo = 0;
            playSoundBallonPop();
            /*Instancia Texto Açao*/
            exibeTextoBad();
        }
        else if (outro.tag == "fire")
        {
            /*Acrescenta ao Score, Som, e Destroy Cheese*/
            roomController.reduzHP(15f);
            nrCombo = 0;
            Destroy(outro.gameObject);
            playSoundBallonPop();
            /*Instancia Texto Açao*/
            exibeTextoBad();
        }
        else if (outro.tag == "dragonTail")
        {
            scoreController.upScore(10);
            scoreController.spawnCheese(outro.transform.position.x, outro.transform.position.y);
            nrCombo += 4;

            /*Destroi Objeto Balao*/
            Destroy(outro.gameObject);
            /*Toca Som Espada*/
            playSoundSword();
            /*Instancia Texto Açao*/
            exibeTextoGood();
            exibeAnimAtk();
        }
    }