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); } }
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; } } }