Exemplo n.º 1
0
        public void Adapt(LookDataObject _look)
        {
            if (Owner == null || _look == null || _look.Enabled == false)
            {
                return;
            }

            //if( m_LastLook.GetHashCode != _look )

            SystemTools.EnableRenderer(Owner.transform, !_look.UseInvisibility);
        }
Exemplo n.º 2
0
        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);
                }
            }
        }