menus and settings
This commit is contained in:
@@ -197,9 +197,27 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
private float _playerHeight;
|
||||
private float _playerRadius;
|
||||
|
||||
private float _lookSensitivityMultiplier = 1.0f;
|
||||
private float _headBobbingMultiplier = 1.0f;
|
||||
private float _fovChangeMultiplier = 1.0f;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
var config = new ConfigFile();
|
||||
|
||||
// Load data from a file.
|
||||
Error err = config.Load("user://config.cfg");
|
||||
|
||||
// If the file didn't load, ignore it.
|
||||
if (err != Error.Ok)
|
||||
{
|
||||
throw new Exception("Couldn't load config.cfg");
|
||||
}
|
||||
|
||||
_lookSensitivityMultiplier = (float) config.GetValue("InputSettings", "LookSensitivity", 1.0f);
|
||||
_headBobbingMultiplier = (float) config.GetValue("InputSettings", "HeadBobbingWhileWalking", 1.0f);
|
||||
_fovChangeMultiplier = (float) config.GetValue("InputSettings", "FovChangeWithSpeed", 1.0f);
|
||||
///////////////////////////
|
||||
// Getting components /////
|
||||
///////////////////////////
|
||||
@@ -944,7 +962,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
private void LookAround()
|
||||
{
|
||||
Vector2 inputLookDir = new Vector2(_inputRotateY, _inputRotateFloorplane);
|
||||
HeadSystem.LookAround(inputLookDir);
|
||||
HeadSystem.LookAround(inputLookDir, _lookSensitivityMultiplier);
|
||||
}
|
||||
|
||||
public void MoveOnGround(double delta)
|
||||
@@ -1023,7 +1041,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
Delta = delta,
|
||||
IsOnFloorCustom = isOnFloorCustom(),
|
||||
Velocity = Velocity
|
||||
Velocity = Velocity,
|
||||
SettingsMultiplier = _headBobbingMultiplier
|
||||
};
|
||||
Bobbing.PerformCameraBobbing(cameraBobbingParams);
|
||||
|
||||
@@ -1032,7 +1051,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
IsCrouchingHeight = CapsuleCollider.IsCrouchingHeight(),
|
||||
Delta = delta,
|
||||
SprintSpeed = WalkSpeed,
|
||||
Velocity = Velocity
|
||||
Velocity = Velocity,
|
||||
FOVMultiplier = _fovChangeMultiplier
|
||||
};
|
||||
FieldOfView.PerformFovAdjustment(fovParams);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user