From d167b39d493356119985f183d340779b0e84307a Mon Sep 17 00:00:00 2001 From: in0finite Date: Sun, 23 Jun 2019 01:56:45 +0200 Subject: [PATCH] move "show speedometer" setting to PedManager --- Assets/Scripts/Behaviours/Ped/PlayerController.cs | 8 +------- Assets/Scripts/Behaviours/PedManager.cs | 1 + Assets/Scripts/Settings/PlayerSettings.cs | 6 +++--- Docs/TODO.md | 2 ++ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/Behaviours/Ped/PlayerController.cs b/Assets/Scripts/Behaviours/Ped/PlayerController.cs index 40d1c94b..b2e4a89b 100644 --- a/Assets/Scripts/Behaviours/Ped/PlayerController.cs +++ b/Assets/Scripts/Behaviours/Ped/PlayerController.cs @@ -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 @@ -97,10 +95,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; diff --git a/Assets/Scripts/Behaviours/PedManager.cs b/Assets/Scripts/Behaviours/PedManager.cs index 2d0e2959..ae50d518 100644 --- a/Assets/Scripts/Behaviours/PedManager.cs +++ b/Assets/Scripts/Behaviours/PedManager.cs @@ -12,6 +12,7 @@ namespace SanAndreasUnity.Behaviours public float pedTurnSpeed = 10f; public float enterVehicleRadius = 2.0f; + public bool showPedSpeedometer = true; [Header("Health bar")] diff --git a/Assets/Scripts/Settings/PlayerSettings.cs b/Assets/Scripts/Settings/PlayerSettings.cs index 8a178284..6d5ff9fd 100644 --- a/Assets/Scripts/Settings/PlayerSettings.cs +++ b/Assets/Scripts/Settings/PlayerSettings.cs @@ -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", diff --git a/Docs/TODO.md b/Docs/TODO.md index 7e8b847d..e2dd1d00 100644 --- a/Docs/TODO.md +++ b/Docs/TODO.md @@ -22,6 +22,8 @@ - Make all settings persistent +- Update controls window + - Add option to change fixed delta time ? - Crouching: adjust camera aim offset ? ;