示例#1
0
        public override void CalcOutput(PlayerEntity player, ICameraMotorInput input, ICameraMotorState state,
                                        SubCameraMotorState subState,
                                        DummyCameraMotorOutput output,
                                        ICameraNewMotor last, int clientTime)
        {
            output.Far          = _config.Far;
            output.Near         = _config.Near;
            output.ForbidDetect = _config.ForbidDetect;

            _transitionTime = CameraUtility.GetPostureTransitionTime(_motorType, subState);
            var elapsedPercent = ElapsedPercent(clientTime, subState.ModeTime, _transitionTime);
            var realPercent    = EaseInOutQuad(0, 1, elapsedPercent);

            if (state.IsFristPersion())
            {
                //一人称和瞄准相机没有偏移
                output.Fov = Mathf.Lerp(last.FinalFov, FinalFov, realPercent);
            }
            else
            {
                if (last is AirplanePoseMotor || last is DrivePoseMotor)
                {
                    realPercent = 1;
                }

                output.ArchorOffset     = Vector3.Lerp(last.FinalArchorOffset, FinalArchorOffset, realPercent);
                output.ArchorPostOffset =
                    Vector3.Lerp(last.FinalArchorPostOffset, FinalArchorPostOffset, realPercent);
                output.Offset           = Vector3.Lerp(last.FinalOffset, FinalOffset, realPercent);
                output.ArchorEulerAngle = Vector3.Lerp(last.FinalEulerAngle, FinalEulerAngle, realPercent);
                output.Fov = Mathf.Lerp(last.FinalFov, FinalFov, realPercent);
            }
        }