void OnTriggerEnter2D(Collider2D col) { //To check whether the collision is defender or not if (col.GetComponent <DefenderController> () == null) { return; } else { attacker.Attack(col.gameObject); anim.SetBool("isAttacking", true); } }
void OnTriggerEnter2D(Collider2D col) { //Check that whether the collision is defender or bullet if (col.GetComponent <DefenderController> () == null) { return; } //Check that whether the collision is stone or other defender if (col.name == "Stone") { anim.SetTrigger("isJumping"); } else { attacker.Attack(col.gameObject); anim.SetBool("isAttacking", true); } }