public virtual void Hit(GameObject _target, Vector3 _hit_point) { if (Owner == null || Enabled == false) { return; } if (_target != null && ImpactBehaviour.RefusedByLayer(_target.layer)) { return; } ICEWorldEntity.SendDamage(Owner, _target, ImpactType, DamageMethodValue, DamageMethodName, _hit_point, ForceType, UnityEngine.Random.Range(ForceMin, ForceMax), ExplosionRadius); ImpactSound.Play(); ImpactEffect.Start(OwnerComponent); }
public override void Hit(GameObject _target, Vector3 _hit_point) { if (Owner == null || Enabled == false) { return; } if ((_target != null && ImpactBehaviour.RefusedByLayer(_target.layer)) || ImpactBehaviour.RefusedByHitCounter) { return; } ICEWorldEntity.SendDamage(Owner, _target, ImpactType, DamageMethodValue, DamageMethodName, _hit_point, ForceType, UnityEngine.Random.Range(ForceMin, ForceMax), ExplosionRadius); ImpactSound.Play(); ImpactEffect.Start(OwnerComponent); if (ImpactBehaviour.Enabled) { // Handle Projectile Rigidbody Rigidbody _rb = Owner.GetComponent <Rigidbody>(); if (_rb != null) { _rb.useGravity = false; _rb.isKinematic = true; _rb.constraints = RigidbodyConstraints.FreezeAll; } if (ImpactBehaviour.UseAttachOnHit) { WorldManager.AttachToTransform(Owner, _target.transform, false); } if (ImpactBehaviour.UseHideOnHit) { SystemTools.EnableRenderer(Owner.transform, false); } if (ImpactBehaviour.UseDestroyOnHit) { WorldManager.Destroy(Owner, ImpactBehaviour.DestroyDelay); } } }