private void Update() { bool buttonDown; bool buttonUp; if (base.dead) { return; } if (!LockCursorManager.IsLocked()) { buttonDown = false; buttonUp = (!Context.WorkingInMenu ? false : Context.ButtonUp); } else { buttonDown = Context.ButtonDown; buttonUp = Context.ButtonUp; } this.hasHighlight = this.ClientCheckUse(base.eyesRay, buttonDown); if (Context.ButtonUp) { Context.EndQuery(); } }
// Token: 0x06000404 RID: 1028 RVA: 0x0001392C File Offset: 0x00011B2C protected void OnEnable() { this.SetLocalOnlyComponentsEnabled(true); LockCursorManager.IsLocked(true); this.onceClock = false; this.clock = Facepunch.Clocks.Counters.SystemTimestamp.Restart; }
// Token: 0x060003BA RID: 954 RVA: 0x00011A18 File Offset: 0x0000FC18 private void Update() { if (base.dead) { return; } bool press; if (LockCursorManager.IsLocked()) { press = global::Context.ButtonDown; bool buttonUp = global::Context.ButtonUp; } else { press = false; bool flag = global::Context.WorkingInMenu && global::Context.ButtonUp; } this.hasHighlight = this.ClientCheckUse(base.eyesRay, press); if (global::Context.ButtonUp) { global::Context.EndQuery(); } }
// Token: 0x0600040A RID: 1034 RVA: 0x00013AD8 File Offset: 0x00011CD8 public static global::HumanController.InputSample Poll(bool noLamp, bool noLaser) { if (global::ConsoleWindow.IsVisible()) { return(default(global::HumanController.InputSample)); } if (global::MainMenu.IsVisible()) { return(default(global::HumanController.InputSample)); } if (global::ChatUI.IsVisible()) { return(default(global::HumanController.InputSample)); } if (global::LockEntry.IsVisible()) { return(default(global::HumanController.InputSample)); } global::HumanController.InputSample result; if (!LockCursorManager.IsLocked(true)) { result = default(global::HumanController.InputSample); if (!global::UIUnityEvents.shouldBlockButtonInput) { result.inventory = global::GameInput.GetButton("Inventory").IsPressed(); } result.lamp = global::HumanController.InputSample.saved.lamp; result.laser = global::HumanController.InputSample.saved.laser; } else { float deltaTime = Time.deltaTime; result.info__crouchBlocked = false; result.walk = 0f; if (global::GameInput.GetButton("Up").IsDown()) { result.walk += 1f; } if (global::GameInput.GetButton("Down").IsDown()) { result.walk -= 1f; } result.strafe = 0f; if (global::GameInput.GetButton("Right").IsDown()) { result.strafe += 1f; } if (global::GameInput.GetButton("Left").IsDown()) { result.strafe -= 1f; } result.yaw = global::GameInput.mouseDeltaX + global::HumanController.InputSample.yawSensitivityJoy * Input.GetAxis("Yaw") * deltaTime; result.pitch = global::GameInput.mouseDeltaY + global::HumanController.InputSample.pitchSensitivityJoy * Input.GetAxis("Pitch") * deltaTime; if (global::input.flipy) { result.pitch *= -1f; } result.jump = global::GameInput.GetButton("Jump").IsDown(); result.crouch = global::GameInput.GetButton("Duck").IsDown(); result.sprint = global::GameInput.GetButton("Sprint").IsDown(); result.aim = false; result.attack = global::GameInput.GetButton("Fire").IsDown(); result.attack2 = global::GameInput.GetButton("AltFire").IsDown(); result.reload = global::GameInput.GetButton("Reload").IsDown(); result.inventory = global::GameInput.GetButton("Inventory").IsPressed(); result.lamp = ((!noLamp) ? global::HumanController.InputSample.saved.GetLamp(global::GameInput.GetButton("Flashlight").IsPressed()) : global::HumanController.InputSample.saved.lamp); result.laser = ((!noLaser) ? global::HumanController.InputSample.saved.GetLaser(global::GameInput.GetButton("Laser").IsPressed()) : global::HumanController.InputSample.saved.laser); } if (global::GameInput.GetButton("Chat").IsPressed()) { global::ChatUI.Open(); } return(result); }
// 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(); } }
public static HumanController.InputSample Poll(bool noLamp, bool noLaser) { HumanController.InputSample inputSample = new HumanController.InputSample(); if (ConsoleWindow.IsVisible()) { return(new HumanController.InputSample()); } if (MainMenu.IsVisible()) { return(new HumanController.InputSample()); } if (ChatUI.IsVisible()) { return(new HumanController.InputSample()); } if (LockEntry.IsVisible()) { return(new HumanController.InputSample()); } if (LockCursorManager.IsLocked(true)) { float single = Time.deltaTime; inputSample.info__crouchBlocked = false; inputSample.walk = 0f; if (GameInput.GetButton("Up").IsDown()) { inputSample.walk = inputSample.walk + 1f; } if (GameInput.GetButton("Down").IsDown()) { inputSample.walk = inputSample.walk - 1f; } inputSample.strafe = 0f; if (GameInput.GetButton("Right").IsDown()) { inputSample.strafe = inputSample.strafe + 1f; } if (GameInput.GetButton("Left").IsDown()) { inputSample.strafe = inputSample.strafe - 1f; } inputSample.yaw = GameInput.mouseDeltaX + HumanController.InputSample.yawSensitivityJoy * Input.GetAxis("Yaw") * single; inputSample.pitch = GameInput.mouseDeltaY + HumanController.InputSample.pitchSensitivityJoy * Input.GetAxis("Pitch") * single; if (input.flipy) { inputSample.pitch = inputSample.pitch * -1f; } inputSample.jump = GameInput.GetButton("Jump").IsDown(); inputSample.crouch = GameInput.GetButton("Duck").IsDown(); inputSample.sprint = GameInput.GetButton("Sprint").IsDown(); inputSample.aim = false; inputSample.attack = GameInput.GetButton("Fire").IsDown(); inputSample.attack2 = GameInput.GetButton("AltFire").IsDown(); inputSample.reload = GameInput.GetButton("Reload").IsDown(); inputSample.inventory = GameInput.GetButton("Inventory").IsPressed(); inputSample.lamp = (!noLamp ? HumanController.InputSample.saved.GetLamp(GameInput.GetButton("Flashlight").IsPressed()) : HumanController.InputSample.saved.lamp); inputSample.laser = (!noLaser ? HumanController.InputSample.saved.GetLaser(GameInput.GetButton("Laser").IsPressed()) : HumanController.InputSample.saved.laser); } else { inputSample = new HumanController.InputSample(); if (!UIUnityEvents.shouldBlockButtonInput) { inputSample.inventory = GameInput.GetButton("Inventory").IsPressed(); } inputSample.lamp = HumanController.InputSample.saved.lamp; inputSample.laser = HumanController.InputSample.saved.laser; } if (GameInput.GetButton("Chat").IsPressed()) { ChatUI.Open(); } return(inputSample); }
private void ProcessInput(ref HumanController.InputSample sample) { bool flag; bool flag1; CCMotor.InputFrame movementScale = new CCMotor.InputFrame(); float single; float single1; CCMotor cCMotor = base.ccmotor; if (!cCMotor) { flag1 = false; flag = true; } else { flag = cCMotor.isGrounded; flag1 = cCMotor.isSliding; if (!flag && !flag1) { 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 <FallDamage>().SendFallImpact(this.lastFrameVelocity); } this.lastFrameVelocity = Vector3.zero; this.midairStartPos = Vector3.zero; } bool flag2 = (sample.crouch ? true : sample.info__crouchBlocked); movementScale.jump = sample.jump; movementScale.moveDirection.x = sample.strafe; movementScale.moveDirection.y = 0f; movementScale.moveDirection.z = sample.walk; movementScale.crouchSpeed = (!sample.crouch ? 1f : -1f); if (movementScale.moveDirection == Vector3.zero) { this.sprinting = false; this.exitingSprint = false; this.sprintTime = 0f; this.crouchTime = (!sample.crouch ? 0f : this.controlConfig.curveCrouchMulSpeedByTime.GetEndTime()); this.magnitudeAir = 1f; } else { float single2 = movementScale.moveDirection.magnitude; if (single2 < 1f) { movementScale.moveDirection = movementScale.moveDirection / single2; single2 = single2 * single2; movementScale.moveDirection = movementScale.moveDirection * single2; } else if (single2 > 1f) { movementScale.moveDirection = movementScale.moveDirection / single2; } if (HumanController.InputSample.MovementScale < 1f) { if (HumanController.InputSample.MovementScale <= 0f) { movementScale.moveDirection = Vector3.zero; } else { movementScale.moveDirection = movementScale.moveDirection * HumanController.InputSample.MovementScale; } } Vector3 vector3 = movementScale.moveDirection; vector3.x = vector3.x * this.controlConfig.sprintScaleX; vector3.z = vector3.z * this.controlConfig.sprintScaleY; if (!sample.sprint || flag2 || sample.aim) { sample.sprint = false; single = -Time.deltaTime; } else { single = Time.deltaTime * this.sprintInMulTime; } movementScale.moveDirection = movementScale.moveDirection + (vector3 * this.controlConfig.curveSprintAddSpeedByTime.EvaluateClampedTime(ref this.sprintTime, single)); single1 = (!flag2 ? -Time.deltaTime : Time.deltaTime * this.crouchInMulTime); movementScale.moveDirection = movementScale.moveDirection * this.controlConfig.curveCrouchMulSpeedByTime.EvaluateClampedTime(ref this.crouchTime, single1); movementScale.moveDirection = base.transform.TransformDirection(movementScale.moveDirection); if (!this.wasInAir) { movementScale.moveDirection = movementScale.moveDirection * this.controlConfig.curveLandingSpeedPenalty.EvaluateClampedTime(ref this.landingSpeedPenaltyTime, Time.deltaTime); } else { float single3 = movementScale.moveDirection.magnitude; if (!Mathf.Approximately(single3, this.magnitudeAir)) { movementScale.moveDirection = movementScale.moveDirection / single3; movementScale.moveDirection = movementScale.moveDirection * this.magnitudeAir; } } } if (DebugInput.GetKey(KeyCode.H)) { movementScale.moveDirection = movementScale.moveDirection * 100f; } cCMotor.input = movementScale; if (cCMotor.stepMode == CCMotor.StepMode.Elsewhere) { cCMotor.Step(); } } Character character = base.idMain; Crouchable crouchable = character.crouchable; if (character) { Angle2 angle2 = base.eyesAngles; Angle2 angle21 = base.eyesAngles; angle2.yaw = Mathf.DeltaAngle(0f, angle21.yaw + sample.yaw); angle2.pitch = base.ClampPitch(angle2.pitch + sample.pitch); base.eyesAngles = angle2; ushort num = character.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 num1 = (!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 ? 64 : 0) | (!LockCursorManager.IsLocked() ? 128 : 0) | (!flag ? 16 : 0) | (!flag1 ? 0 : 32) | (!this.bleeding ? 0 : 512) | (!sample.lamp ? 0 : 2048) | (!sample.laser ? 0 : 4096) | (!sample.info__crouchBlocked ? 0 : 1024); character.stateFlags = num1; if (num != num1) { character.Signal_State_FlagsChanged(false); } } this.crouch_was_blocked = sample.info__crouchBlocked; if (sample.inventory) { RPOS.Toggle(); } if (Input.GetKeyDown(KeyCode.Escape)) { RPOS.Hide(); } }
private void ProcessInput(ref InputSample sample) { bool isGrounded; bool isSliding; CCMotor ccmotor = base.ccmotor; if (ccmotor != null) { CCMotor.InputFrame frame; isGrounded = ccmotor.isGrounded; isSliding = ccmotor.isSliding; if (!isGrounded && !isSliding) { 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((float)(base.transform.position.y - this.midairStartPos.y)) > 2f)) { base.idMain.GetLocal <FallDamage>().SendFallImpact(this.lastFrameVelocity); } this.lastFrameVelocity = Vector3.zero; this.midairStartPos = Vector3.zero; } bool flag3 = sample.crouch || sample.info__crouchBlocked; frame.jump = sample.jump; frame.moveDirection.x = sample.strafe; frame.moveDirection.y = 0f; frame.moveDirection.z = sample.walk; frame.crouchSpeed = !sample.crouch ? 1f : -1f; if (frame.moveDirection != Vector3.zero) { float num2; float num3; float magnitude = frame.moveDirection.magnitude; if (magnitude < 1f) { frame.moveDirection = (Vector3)(frame.moveDirection / magnitude); magnitude *= magnitude; frame.moveDirection = (Vector3)(frame.moveDirection * magnitude); } else if (magnitude > 1f) { frame.moveDirection = (Vector3)(frame.moveDirection / magnitude); } if (InputSample.MovementScale < 1f) { if (InputSample.MovementScale > 0f) { frame.moveDirection = (Vector3)(frame.moveDirection * InputSample.MovementScale); } else { frame.moveDirection = Vector3.zero; } } Vector3 moveDirection = frame.moveDirection; moveDirection.x *= this.controlConfig.sprintScaleX; moveDirection.z *= this.controlConfig.sprintScaleY; if ((sample.sprint && !flag3) && !sample.aim) { num2 = Time.deltaTime * this.sprintInMulTime; } else { sample.sprint = false; num2 = -Time.deltaTime; } frame.moveDirection += (Vector3)(moveDirection * this.controlConfig.curveSprintAddSpeedByTime.EvaluateClampedTime(ref this.sprintTime, num2)); if (flag3) { num3 = Time.deltaTime * this.crouchInMulTime; } else { num3 = -Time.deltaTime; } frame.moveDirection = (Vector3)(frame.moveDirection * this.controlConfig.curveCrouchMulSpeedByTime.EvaluateClampedTime(ref this.crouchTime, num3)); frame.moveDirection = base.transform.TransformDirection(frame.moveDirection); if (this.wasInAir) { float a = frame.moveDirection.magnitude; if (!Mathf.Approximately(a, this.magnitudeAir)) { frame.moveDirection = (Vector3)(frame.moveDirection / a); frame.moveDirection = (Vector3)(frame.moveDirection * this.magnitudeAir); } } else { frame.moveDirection = (Vector3)(frame.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 (DebugInput.GetKey(KeyCode.H)) { frame.moveDirection = (Vector3)(frame.moveDirection * 100f); } ccmotor.input = frame; if (ccmotor.stepMode == CCMotor.StepMode.Elsewhere) { ccmotor.Step(); } } else { isSliding = false; isGrounded = true; } Character idMain = base.idMain; Crouchable crouchable = idMain.crouchable; if (idMain != null) { Angle2 eyesAngles = base.eyesAngles; eyesAngles.yaw = Mathf.DeltaAngle(0f, base.eyesAngles.yaw + sample.yaw); eyesAngles.pitch = base.ClampPitch((float)(eyesAngles.pitch + sample.pitch)); base.eyesAngles = eyesAngles; ushort flags = idMain.stateFlags.flags; if (crouchable != null) { this.crouch_smoothing.AddSeconds((double)Time.deltaTime); crouchable.LocalPlayerUpdateCrouchState(ccmotor, ref sample.crouch, ref sample.info__crouchBlocked, ref this.crouch_smoothing); } int num6 = ((((((((((((!sample.aim ? 0 : 4) | (!sample.sprint ? 0 : 2)) | (!sample.attack ? 0 : 8)) | (!sample.attack2 ? 0 : 0x100)) | (!sample.crouch ? 0 : 1)) | (((sample.strafe == 0f) && (sample.walk == 0f)) ? 0 : 0x40)) | (!LockCursorManager.IsLocked() ? 0x80 : 0)) | (!isGrounded ? 0x10 : 0)) | (!isSliding ? 0 : 0x20)) | (!this.bleeding ? 0 : 0x200)) | (!sample.lamp ? 0 : 0x800)) | (!sample.laser ? 0 : 0x1000)) | (!sample.info__crouchBlocked ? 0 : 0x400); idMain.stateFlags = num6; if (flags != num6) { idMain.Signal_State_FlagsChanged(false); } } this.crouch_was_blocked = sample.info__crouchBlocked; if (sample.inventory) { RPOS.Toggle(); } if (Input.GetKeyDown(KeyCode.Escape)) { RPOS.Hide(); } }