| | 1 | | using Cinemachine; |
| | 2 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers |
| | 6 | | { |
| | 7 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Mouse Sensitivity", fileName = "MouseSensitivityControlCo |
| | 8 | | public class MouseSensivityControlController : SliderSettingsControlController |
| | 9 | | { |
| | 10 | | internal const float FIRST_PERSON_MIN_SPEED = 25f / 100f; |
| | 11 | | internal const float FIRST_PERSON_MAX_SPEED = 350f / 100f; |
| | 12 | | internal const float THIRD_PERSON_X_MIN_SPEED = 4.5f / 10f; |
| | 13 | | internal const float THIRD_PERSON_X_MAX_SPEED = 4.5f; |
| | 14 | | internal const float THIRD_PERSON_Y_MIN_SPEED = 0.05f / 10f; |
| | 15 | | internal const float THIRD_PERSON_Y_MAX_SPEED = 0.05f; |
| | 16 | | private CinemachinePOV povCamera; |
| | 17 | |
|
| | 18 | | public override void Initialize() |
| | 19 | | { |
| 2 | 20 | | base.Initialize(); |
| | 21 | |
|
| 2 | 22 | | povCamera = SceneReferences.i.firstPersonCamera.GetCinemachineComponent<CinemachinePOV>(); |
| 2 | 23 | | } |
| | 24 | |
|
| 2 | 25 | | public override object GetStoredValue() { return currentGeneralSettings.mouseSensitivity; } |
| | 26 | |
|
| | 27 | | public override void UpdateSetting(object newValue) |
| | 28 | | { |
| 2 | 29 | | currentGeneralSettings.mouseSensitivity = (float)newValue; |
| | 30 | |
|
| 2 | 31 | | var povSpeed = Mathf.Lerp(FIRST_PERSON_MIN_SPEED, FIRST_PERSON_MAX_SPEED, currentGeneralSettings.mouseSensit |
| 2 | 32 | | povCamera.m_HorizontalAxis.m_MaxSpeed = povSpeed; |
| 2 | 33 | | povCamera.m_VerticalAxis.m_MaxSpeed = povSpeed; |
| 2 | 34 | | SceneReferences.i.thirdPersonCamera.m_XAxis.m_MaxSpeed = Mathf.Lerp(THIRD_PERSON_X_MIN_SPEED, THIRD_PERSON_X |
| 2 | 35 | | SceneReferences.i.thirdPersonCamera.m_YAxis.m_MaxSpeed = Mathf.Lerp(THIRD_PERSON_Y_MIN_SPEED, THIRD_PERSON_Y |
| 2 | 36 | | } |
| | 37 | | } |
| | 38 | | } |