コード例 #1
0
        // Token: 0x06000B08 RID: 2824 RVA: 0x00036C74 File Offset: 0x00034E74
        private void UpdateLocalAnglesToAimVector()
        {
            Vector3 vector      = this.inputBank ? this.inputBank.aimDirection : base.transform.forward;
            float   y           = this.directionComponent ? this.directionComponent.yaw : base.transform.eulerAngles.y;
            Vector3 eulerAngles = Util.QuaternionSafeLookRotation(vector, Vector3.up).eulerAngles;
            Vector3 vector2     = new Vector3(0f, y, 0f);
            Vector3 vector3     = vector;

            vector3.y = 0f;
            this.localAnglesToAimVector = new AimAnimator.AimAngles
            {
                pitch = -Mathf.Atan2(vector.y, vector3.magnitude) * 57.29578f,
                yaw   = AimAnimator.NormalizeAngle(eulerAngles.y - vector2.y)
            };
            this.overshootAngles = new AimAnimator.AimAngles
            {
                pitch = Mathf.Max(this.pitchRangeMin - this.localAnglesToAimVector.pitch, this.localAnglesToAimVector.pitch - this.pitchRangeMax),
                yaw   = Mathf.Max(Mathf.DeltaAngle(this.localAnglesToAimVector.yaw, this.yawRangeMin), Mathf.DeltaAngle(this.yawRangeMax, this.localAnglesToAimVector.yaw))
            };
            this.clampedLocalAnglesToAimVector = new AimAnimator.AimAngles
            {
                pitch = Mathf.Clamp(this.localAnglesToAimVector.pitch, this.pitchRangeMin, this.pitchRangeMax),
                yaw   = Mathf.Clamp(this.localAnglesToAimVector.yaw, this.yawRangeMin, this.yawRangeMax)
            };
        }
コード例 #2
0
        // Token: 0x06000B09 RID: 2825 RVA: 0x00036E20 File Offset: 0x00035020
        private void ApproachDesiredAngles()
        {
            AimAnimator.AimAngles aimAngles;
            float maxSpeed;

            if (this.shouldGiveup)
            {
                aimAngles = new AimAnimator.AimAngles
                {
                    pitch = 0f,
                    yaw   = 0f
                };
                maxSpeed = this.loweredApproachSpeed;
            }
            else
            {
                aimAngles = this.clampedLocalAnglesToAimVector;
                maxSpeed  = this.raisedApproachSpeed;
            }
            float yaw;

            if (this.fullYaw)
            {
                yaw = AimAnimator.NormalizeAngle(Mathf.SmoothDampAngle(this.currentLocalAngles.yaw, aimAngles.yaw, ref this.smoothingVelocity.yaw, this.smoothTime, maxSpeed, Time.deltaTime));
            }
            else
            {
                yaw = Mathf.SmoothDamp(this.currentLocalAngles.yaw, aimAngles.yaw, ref this.smoothingVelocity.yaw, this.smoothTime, maxSpeed, Time.deltaTime);
            }
            this.currentLocalAngles = new AimAnimator.AimAngles
            {
                pitch = Mathf.SmoothDampAngle(this.currentLocalAngles.pitch, aimAngles.pitch, ref this.smoothingVelocity.pitch, this.smoothTime, maxSpeed, Time.deltaTime),
                yaw   = yaw
            };
        }
コード例 #3
0
        // Token: 0x06000B0E RID: 2830 RVA: 0x00037018 File Offset: 0x00035218
        public void UpdateAnimatorParameters(Animator animator, float pitchRangeMin, float pitchRangeMax, float yawRangeMin, float yawRangeMax)
        {
            float num = 1f;

            if (this.enableAimWeight)
            {
                num = this.animatorComponent.GetFloat(AimAnimator.aimWeightHash);
            }
            animator.SetFloat(AimAnimator.aimPitchCycleHash, AimAnimator.Remap(this.currentLocalAngles.pitch * num, pitchRangeMin, pitchRangeMax, this.pitchClipCycleEnd, 0f));
            animator.SetFloat(AimAnimator.aimYawCycleHash, AimAnimator.Remap(this.currentLocalAngles.yaw * num, yawRangeMin, yawRangeMax, 0f, this.yawClipCycleEnd));
        }