private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.tag != "Bullet" && collision.gameObject.tag == targetList[crashalbeTarget]) { crashTargetHP = collision.gameObject.GetComponent <Common_HP>(); if (!crashTargetHP.isInvicible) { crashTargetHP.damage(crashDamage); } } else { Physics2D.IgnoreCollision(collision.gameObject.GetComponent <Collider2D>(), GetComponent <Collider2D>()); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == targetList[target]) { GameObject hitTarget = collision.gameObject; targetHP = hitTarget.GetComponent <Common_HP>(); if (!targetHP.isInvicible) { targetHP.damage(atk); } if (!isPiercing) { Destroy(gameObject); } } }