wip: Critical Path Blocking
This commit is contained in:
@@ -35,6 +35,12 @@ namespace OctoCore.Components
|
||||
public PlayerModes Mode = PlayerModes.FirstPerson;
|
||||
public Orientations Orientation = Orientations.Camera;
|
||||
|
||||
[Tooltip("Allow position movement.")]
|
||||
public bool AllowMove = true;
|
||||
|
||||
[Tooltip("Allow looking around.")]
|
||||
public bool AllowLook = true;
|
||||
|
||||
[Tooltip("Walk speed (km/h).")]
|
||||
public float WalkSpeed = 10;
|
||||
|
||||
@@ -229,7 +235,7 @@ namespace OctoCore.Components
|
||||
|
||||
private void HandleMovement()
|
||||
{
|
||||
_moveInput = (State.IsPaused || !State.IsFocussed) ? Vector2.zero : Vector2.ClampMagnitude(_moveInput, 1);
|
||||
_moveInput = (State.IsPaused || !State.IsFocussed || !_settings.AllowMove) ? Vector2.zero : Vector2.ClampMagnitude(_moveInput, 1);
|
||||
Camera cam = (_firstPerson.Camera && _firstPerson.Camera.enabled && _firstPerson.Camera.gameObject.activeInHierarchy) ? _firstPerson.Camera : Camera.main;
|
||||
|
||||
bool accelerating = _moveInput.magnitude > .1f;
|
||||
@@ -324,11 +330,14 @@ namespace OctoCore.Components
|
||||
{
|
||||
Vector2 delta = (State.IsPaused || !State.IsFocussed) ? Vector2.zero : _lookInput;
|
||||
|
||||
float mouseX = delta.x * _firstPerson.SensitivityX;
|
||||
float mouseY = delta.y * _firstPerson.SensitivityY * -1;
|
||||
if (_settings.AllowLook)
|
||||
{
|
||||
float mouseX = delta.x * _firstPerson.SensitivityX;
|
||||
float mouseY = delta.y * _firstPerson.SensitivityY * -1;
|
||||
|
||||
State.Yaw += mouseX;
|
||||
State.Pitch = Mathf.Clamp(State.Pitch + mouseY, _firstPerson.MinPitch, _firstPerson.MaxPitch);
|
||||
State.Yaw += mouseX;
|
||||
State.Pitch = Mathf.Clamp(State.Pitch + mouseY, _firstPerson.MinPitch, _firstPerson.MaxPitch);
|
||||
}
|
||||
|
||||
if (State.Driver)
|
||||
State.Driver.ApplyLookInfluence(State.Yaw, State.Pitch, Time.deltaTime, out State.Yaw, out State.Pitch);
|
||||
|
||||
Reference in New Issue
Block a user