public override void BuildInput(ClientInput input) { if (thirdperson_orbit && input.Down(InputButton.Walk)) { if (input.Down(InputButton.Attack1)) { orbitDistance += input.AnalogLook.pitch; orbitDistance = orbitDistance.Clamp(0, 1000); } else { orbitAngles.yaw += input.AnalogLook.yaw; orbitAngles.pitch += input.AnalogLook.pitch; orbitAngles = orbitAngles.Normal; orbitAngles.pitch = orbitAngles.pitch.Clamp(-89, 89); } input.AnalogLook = Angles.Zero; input.Clear(); input.StopProcessing = true; } base.BuildInput(input); }
/// <summary> /// Called from the gamemode, clientside only. /// </summary> public override void BuildInput(ClientInput input) { VoiceRecord = input.Down(InputButton.Voice); GetActiveCamera()?.BuildInput(input); if (input.StopProcessing) { return; } GetActiveController()?.BuildInput(input); if (input.StopProcessing) { return; } GetActiveAnimator()?.BuildInput(input); if (input.StopProcessing) { return; } if (ActiveChild is IPlayerInput ipc) { ipc.BuildInput(input); } }
/// <summary> /// Clientside only. Called every frame to process the input. /// The results of this input are encoded into a user command and /// passed to the PlayerController both clientside and serverside. /// This routine is mainly responsible for taking input from mouse/controller /// and building look angles and move direction. /// </summary> public override void OnInput(ClientInput input) { var target = Player.Local; if (target != null) { target.BuildInput(input); } }
public override void BuildInput(ClientInput input) { MoveInput = input.AnalogMove; MoveSpeed = 1; if (input.Down(InputButton.Run)) { MoveSpeed = 5; } if (input.Down(InputButton.Duck)) { MoveSpeed = 0.2f; } if (input.Pressed(InputButton.Walk)) { var tr = Trace.Ray(Pos, Pos + Rot.Forward * 4096).Run(); PivotPos = tr.EndPos; PivotDist = Vector3.DistanceBetween(tr.EndPos, Pos); } if (input.Down(InputButton.Use)) { DoFBlurSize = Math.Clamp(DoFBlurSize + (Time.Delta * 3.0f), 0.0f, 100.0f); } if (input.Down(InputButton.Menu)) { DoFBlurSize = Math.Clamp(DoFBlurSize - (Time.Delta * 3.0f), 0.0f, 100.0f); } if (input.Down(InputButton.Attack2)) { FovOverride += input.AnalogLook.pitch * (FovOverride / 30.0f); FovOverride = FovOverride.Clamp(5, 150); input.AnalogLook = default; } LookAngles += input.AnalogLook * (FovOverride / 80.0f); LookAngles.roll = 0; PivotEnabled = input.Down(InputButton.Walk); if (input.Pressed(InputButton.Reload)) { Overlays = !Overlays; } input.Clear(); input.StopProcessing = true; }
/// <summary> /// This builds the default behaviour for our input /// </summary> public override void BuildInput(ClientInput input) { // // If we're using the mouse then // increase pitch sensitivity // if (input.UsingMouse) { input.AnalogLook.pitch *= 1.5f; } // add the view move, clamp pitch input.ViewAngles += input.AnalogLook; input.ViewAngles.pitch = input.ViewAngles.pitch.Clamp(-89, 89); // Just copy input as is input.InputDirection = input.AnalogMove; }
public abstract void BuildInput(ClientInput input);
public virtual void BuildInput(ClientInput input) { throw new NotImplementedException(); }
public abstract void OnInput(ClientInput input);