public virtual void ApplyDamage() { for (int i = 0; i < _intersectingColliders.Count; i++) { Collider c = _intersectingColliders[i]; if (!c) { _intersectingColliders.Remove(c); i--; } else { DamageReciever dr = c.GetComponent <DamageReciever>(); if (dr) { if (_damageRecipient) { if (_damageRecipient == c.gameObject) { dr.TakeDamageFrom(this); } } else { dr.TakeDamageFrom(this); } } } } SetFreezePosition(false); currentlyAttacking = false; }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject == de.owner) { return; } DamageReciever dr = collision.gameObject.GetComponent <DamageReciever>(); if (dr) { dr.TakeDamageFrom(de); } Destroy(gameObject); }