// Token: 0x06000871 RID: 2161 RVA: 0x00024324 File Offset: 0x00022524
    protected override void Syncronize()
    {
        double time = global::Interpolation.time;
        global::CharacterStateInterpolatorData characterStateInterpolatorData;

        if (this.Sample(ref time, out characterStateInterpolatorData))
        {
            global::Character idMain = base.idMain;
            if (idMain)
            {
                idMain.origin     = characterStateInterpolatorData.origin;
                idMain.eyesAngles = characterStateInterpolatorData.eyesAngles;
                global::CharacterStateFlags stateFlags = idMain.stateFlags;
                idMain.stateFlags = characterStateInterpolatorData.state;
                if (!stateFlags.Equals(characterStateInterpolatorData.state))
                {
                    if (!this.once)
                    {
                        idMain.Signal_State_FlagsChanged(true);
                        this.once = true;
                    }
                    else
                    {
                        idMain.Signal_State_FlagsChanged(false);
                    }
                }
            }
        }
    }
Example #2
0
    // Token: 0x060003F0 RID: 1008 RVA: 0x00012AD8 File Offset: 0x00010CD8
    private void ProcessInput(ref global::HumanController.InputSample sample)
    {
        global::CCMotor ccmotor = base.ccmotor;
        bool            flag;
        bool            flag2;

        if (ccmotor)
        {
            flag  = ccmotor.isGrounded;
            flag2 = ccmotor.isSliding;
            if (!flag && !flag2)
            {
                sample.sprint = false;
                sample.crouch = false;
                sample.aim    = false;
                sample.info__crouchBlocked = false;
                if (!this.wasInAir)
                {
                    this.wasInAir       = true;
                    this.magnitudeAir   = ccmotor.input.moveDirection.magnitude;
                    this.midairStartPos = base.transform.position;
                }
                this.lastFrameVelocity = ccmotor.velocity;
            }
            else if (this.wasInAir)
            {
                this.wasInAir                = false;
                this.magnitudeAir            = 1f;
                this.landingSpeedPenaltyTime = 0f;
                if (base.transform.position.y < this.midairStartPos.y && Mathf.Abs(base.transform.position.y - this.midairStartPos.y) > 2f)
                {
                    base.idMain.GetLocal <global::FallDamage>().SendFallImpact(this.lastFrameVelocity);
                }
                this.lastFrameVelocity = Vector3.zero;
                this.midairStartPos    = Vector3.zero;
            }
            bool flag3 = sample.crouch || sample.info__crouchBlocked;
            global::CCMotor.InputFrame input;
            input.jump            = sample.jump;
            input.moveDirection.x = sample.strafe;
            input.moveDirection.y = 0f;
            input.moveDirection.z = sample.walk;
            input.crouchSpeed     = ((!sample.crouch) ? 1f : -1f);
            if (input.moveDirection != Vector3.zero)
            {
                float num = input.moveDirection.magnitude;
                if (num < 1f)
                {
                    input.moveDirection /= num;
                    num *= num;
                    input.moveDirection *= num;
                }
                else if (num > 1f)
                {
                    input.moveDirection /= num;
                }
                if (global::HumanController.InputSample.MovementScale < 1f)
                {
                    if (global::HumanController.InputSample.MovementScale > 0f)
                    {
                        input.moveDirection *= global::HumanController.InputSample.MovementScale;
                    }
                    else
                    {
                        input.moveDirection = Vector3.zero;
                    }
                }
                Vector3 moveDirection = input.moveDirection;
                moveDirection.x *= this.controlConfig.sprintScaleX;
                moveDirection.z *= this.controlConfig.sprintScaleY;
                float advance;
                if (sample.sprint && !flag3 && !sample.aim)
                {
                    advance = Time.deltaTime * this.sprintInMulTime;
                }
                else
                {
                    sample.sprint = false;
                    advance       = -Time.deltaTime;
                }
                input.moveDirection += moveDirection * this.controlConfig.curveSprintAddSpeedByTime.EvaluateClampedTime(ref this.sprintTime, advance);
                float advance2;
                if (flag3)
                {
                    advance2 = Time.deltaTime * this.crouchInMulTime;
                }
                else
                {
                    advance2 = -Time.deltaTime;
                }
                input.moveDirection *= this.controlConfig.curveCrouchMulSpeedByTime.EvaluateClampedTime(ref this.crouchTime, advance2);
                input.moveDirection  = base.transform.TransformDirection(input.moveDirection);
                if (this.wasInAir)
                {
                    float magnitude = input.moveDirection.magnitude;
                    if (!Mathf.Approximately(magnitude, this.magnitudeAir))
                    {
                        input.moveDirection /= magnitude;
                        input.moveDirection *= this.magnitudeAir;
                    }
                }
                else
                {
                    input.moveDirection *= this.controlConfig.curveLandingSpeedPenalty.EvaluateClampedTime(ref this.landingSpeedPenaltyTime, Time.deltaTime);
                }
            }
            else
            {
                this.sprinting     = false;
                this.exitingSprint = false;
                this.sprintTime    = 0f;
                this.crouchTime    = ((!sample.crouch) ? 0f : this.controlConfig.curveCrouchMulSpeedByTime.GetEndTime());
                this.magnitudeAir  = 1f;
            }
            if (global::DebugInput.GetKey(104))
            {
                input.moveDirection *= 100f;
            }
            ccmotor.input = input;
            if (ccmotor.stepMode == global::CCMotor.StepMode.Elsewhere)
            {
                ccmotor.Step();
            }
        }
        else
        {
            flag2 = false;
            flag  = true;
        }
        global::Character  idMain     = base.idMain;
        global::Crouchable crouchable = idMain.crouchable;

        if (idMain)
        {
            global::Angle2 eyesAngles = base.eyesAngles;
            eyesAngles.yaw   = Mathf.DeltaAngle(0f, base.eyesAngles.yaw + sample.yaw);
            eyesAngles.pitch = base.ClampPitch(eyesAngles.pitch + sample.pitch);
            base.eyesAngles  = eyesAngles;
            ushort flags = idMain.stateFlags.flags;
            if (crouchable)
            {
                this.crouch_smoothing.AddSeconds((double)Time.deltaTime);
                crouchable.LocalPlayerUpdateCrouchState(ccmotor, ref sample.crouch, ref sample.info__crouchBlocked, ref this.crouch_smoothing);
            }
            int num2 = ((!sample.aim) ? 0 : 4) | ((!sample.sprint) ? 0 : 2) | ((!sample.attack) ? 0 : 8) | ((!sample.attack2) ? 0 : 256) | ((!sample.crouch) ? 0 : 1) | ((sample.strafe == 0f && sample.walk == 0f) ? 0 : 64) | ((!LockCursorManager.IsLocked()) ? 128 : 0) | ((!flag) ? 16 : 0) | ((!flag2) ? 0 : 32) | ((!this.bleeding) ? 0 : 512) | ((!sample.lamp) ? 0 : 2048) | ((!sample.laser) ? 0 : 4096) | ((!sample.info__crouchBlocked) ? 0 : 1024);
            idMain.stateFlags = num2;
            if ((int)flags != num2)
            {
                idMain.Signal_State_FlagsChanged(false);
            }
        }
        this.crouch_was_blocked = sample.info__crouchBlocked;
        if (sample.inventory)
        {
            global::RPOS.Toggle();
        }
        if (Input.GetKeyDown(27))
        {
            global::RPOS.Hide();
        }
    }