private void OnTriggerEnter(Collider other) { if (isAttacking) { ITakeDamage health = other.gameObject.GetComponent <ITakeDamage>(); if (health != null) { health.OnDamageTaken(damage); } } }
protected virtual void OnTriggerEnter(Collider other) { ITakeDamage target = other.gameObject.GetComponent <ITakeDamage>(); if (target != null) { target.OnDamageTaken(damage); } rigid.velocity = Vector3.zero; rigid.useGravity = true; trail.enabled = false; }