protected virtual void OnTriggerEnter(Collider collider) { IDamagable damagable = collider.GetComponent <IDamagable>() as IDamagable; if (damagable != null && ((!GameOvermind.instance.friendlyFire && damagable.GetSideId() != firedFromSideId) || GameOvermind.instance.friendlyFire)) { damagable.SetDamage(damage); Destroy(null); OnDestroyed?.Invoke(this); } }
public void OnCollisionEnter(Collision collision) { IDamagable damagable = collision.collider.GetComponent <IDamagable>() as IDamagable; Debug.Log("[MeleeWeapon] melee hit" + damagable); if (damagable != null && (object)damagable != owner && damagable.GetSideId() != owner.TeamId) { damagable.SetDamage(damage); } OnMeleeWeaponHit?.Invoke(collision.contacts[0].point); }