move "show speedometer" setting to PedManager

This commit is contained in:
in0finite 2019-06-23 01:56:45 +02:00
parent ce0fb3ffa9
commit d167b39d49
4 changed files with 7 additions and 10 deletions

View file

@ -17,8 +17,6 @@ namespace SanAndreasUnity.Behaviours
private Ped m_ped;
public static bool _showVel = true;
// Alpha speedometer
private const float velTimer = 1 / 4f;
@ -71,7 +69,7 @@ namespace SanAndreasUnity.Behaviours
GUILayout.EndArea();
}
if (_showVel)
if (PedManager.Instance.showPedSpeedometer)
GUI.Label(GUIUtils.GetCornerRect(ScreenCorner.TopLeft, 100, 25, new Vector2(5, 5)), string.Format("{0:0.0} km/h", m_deltaPos.magnitude * 3.6f / velTimer), new GUIStyle("label") { alignment = TextAnchor.MiddleCenter });
// show current ped state
@ -98,10 +96,6 @@ namespace SanAndreasUnity.Behaviours
if (!m_ped.IsControlledByLocalPlayer)
return;
// FIXME: this should not be here
if (Input.GetKeyDown(KeyCode.F9))
_showVel = !_showVel;
if (!Loader.HasLoaded)
return;

View file

@ -12,6 +12,7 @@ namespace SanAndreasUnity.Behaviours
public float pedTurnSpeed = 10f;
public float enterVehicleRadius = 2.0f;
public bool showPedSpeedometer = true;
[Header("Health bar")]

View file

@ -26,9 +26,9 @@ namespace SanAndreasUnity.Settings {
OptionsWindow.BoolInput m_showSpeedometerInput = new OptionsWindow.BoolInput() {
description = "Show speedometer",
isAvailable = () => PlayerController.Instance != null,
getValue = () => PlayerController._showVel,
setValue = (value) => { PlayerController._showVel = value; },
isAvailable = () => PedManager.Instance != null,
getValue = () => PedManager.Instance.showPedSpeedometer,
setValue = (value) => { PedManager.Instance.showPedSpeedometer = value; },
};
OptionsWindow.FloatInput m_mouseSensitivityXInput = new OptionsWindow.FloatInput() {
description = "Mouse sensitivity x",

View file

@ -22,6 +22,8 @@
- Make all settings persistent
- Update controls window
- Add option to change fixed delta time ?
- Crouching: adjust camera aim offset ? ;