Example #1
0
    void OnTriggerEnter(Collider collision)
    {
        new WaitForSeconds(0.1f);
        if (collision.tag == "Enemy")
        {
            EnemyLife life = collision.GetComponent <EnemyLife>();
            life.recibirDaño(daño);
            Destroy(this.gameObject);
        }

        if (collision.tag == "Breakable")
        {
            Destruction destr = collision.GetComponent <Destruction>();
            destr.Destruir();
            Destroy(this.gameObject);
        }
    }
Example #2
0
    void OnTriggerEnter(Collider collision)
    {
        if (ataque)
        {
            if (collision.tag == "Enemy")
            {
                EnemyLife life = collision.GetComponent <EnemyLife>();
                life.recibirDaño(100);
                ataque = false;
            }

            if (collision.tag == "Breakable")
            {
                Destruction destr = collision.GetComponent <Destruction>();
                destr.Destruir();
                ataque = false;
            }
        }
    }