protected virtual bool ApplyDamage(Collider2D collider) { if (collider.tag == "projectile") { return(false); } if (!canHurtEnemy && collider.tag == "enemy") { return(false); } if (!canHurtPlayer && collider.tag == "Player") { return(false); } Damagable dmgComponent = collider.GetComponent <Damagable>(); if (dmgComponent) { dmgComponent.OnHit(damageOnContact, (collider.transform.position - transform.position).normalized); } return(true); }