Ejemplo n.º 1
0
 public void CustumLateUpdate()
 {
     if (this.myRenderer != null && this.ActorObj != null)
     {
         bool isVisible = this.myRenderer.isVisible;
         if (isVisible != this.ActorObj.InCamera)
         {
             this.ActorObj.InCamera = isVisible;
             if (this.ActorObj.InCamera)
             {
                 if (this.ActorObj.isMovable)
                 {
                     this.oldLocation          = this.ActorObj.location;
                     this.myTransform.position = (Vector3)this.ActorObj.location;
                 }
                 if (this.ActorObj.isRotatable)
                 {
                     VInt3   forward  = this.ActorObj.forward;
                     VFactor vFactor  = VInt3.AngleInt(forward, VInt3.forward);
                     int     arg_CE_0 = forward.x;
                     VInt3   forward2 = VInt3.forward;
                     int     arg_E5_0 = arg_CE_0 * forward2.z;
                     VInt3   forward3 = VInt3.forward;
                     int     num      = arg_E5_0 - forward3.x * forward.z;
                     if (num < 0)
                     {
                         vFactor = VFactor.twoPi - vFactor;
                     }
                     this.tarRotation          = Quaternion.AngleAxis(vFactor.get_single() * 57.29578f, Vector3.up);
                     this.myTransform.rotation = this.tarRotation;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        protected void UpdateRotateDir(VInt3 targetDir, int dt)
        {
            ActorRoot actor = this.Parent.actor;

            if (targetDir == VInt3.zero)
            {
                return;
            }
            actor.ObjLinker.SetForward(targetDir, this.Parent.actor.ActorControl.curMoveSeq);
            if (actor.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveRotate))
            {
                return;
            }
            actor.forward = targetDir;
            if (actor.InCamera)
            {
                Vector3 forward = this.Parent.actor.myTransform.forward;
                ((Vector3)targetDir).y = 0f;
                forward.y = 0f;
                VFactor vFactor  = VInt3.AngleInt(targetDir, VInt3.forward);
                int     arg_B8_0 = targetDir.x;
                VInt3   forward2 = VInt3.forward;
                int     arg_CF_0 = arg_B8_0 * forward2.z;
                VInt3   forward3 = VInt3.forward;
                int     num      = arg_CF_0 - forward3.x * targetDir.z;
                if (num < 0)
                {
                    vFactor = VFactor.twoPi - vFactor;
                }
                Quaternion to = Quaternion.AngleAxis(vFactor.get_single() * 57.29578f, Vector3.up);
                actor.rotation = Quaternion.RotateTowards(actor.rotation, to, (float)(this.Parent.RotateSpeed * dt) * 0.001f);
            }
        }
Ejemplo n.º 3
0
        public void SetForward(VInt3 InDir, int nSeq)
        {
            if (!this.bNeedLerp || !this.ActorObj.InCamera)
            {
                return;
            }
            bool flag = false;

            if (this.nPreMoveSeq < 0 || nSeq < 0 || nSeq == this.nPreMoveSeq)
            {
                flag = true;
            }
            else if (nSeq > this.nPreMoveSeq)
            {
                byte b  = (byte)nSeq;
                byte b2 = (byte)this.nPreMoveSeq;
                b   -= 128;
                b2  -= 128;
                flag = (b < b2);
            }
            if (flag)
            {
                this.moveForward = ((Vector3)InDir).normalized;
                VInt3 vInt;
                if (this.ActorObj.ActorControl != null && this.ActorObj.ActorControl.CanRotate)
                {
                    vInt = (VInt3)this.moveForward;
                }
                else
                {
                    vInt = this.ActorObj.forward;
                }
                VFactor vFactor   = VInt3.AngleInt(vInt, VInt3.forward);
                int     arg_F3_0  = vInt.x;
                VInt3   forward   = VInt3.forward;
                int     arg_10A_0 = arg_F3_0 * forward.z;
                VInt3   forward2  = VInt3.forward;
                int     num       = arg_10A_0 - forward2.x * vInt.z;
                if (num < 0)
                {
                    vFactor = VFactor.twoPi - vFactor;
                }
                this.tarRotation = Quaternion.AngleAxis(vFactor.get_single() * 57.29578f, Vector3.up);
            }
        }