< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.MouseSensivityControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/MouseSensivityControlController.cs
Covered lines:11
Uncovered lines:0
Coverable lines:11
Total lines:38
Line coverage:100% (11 of 11)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize()0%110100%
GetStoredValue()0%110100%
UpdateSetting(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/MouseSensivityControlController.cs

#LineLine coverage
 1using Cinemachine;
 2using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 3using UnityEngine;
 4
 5namespace 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        {
 220            base.Initialize();
 21
 222            povCamera = SceneReferences.i.firstPersonCamera.GetCinemachineComponent<CinemachinePOV>();
 223        }
 24
 225        public override object GetStoredValue() { return currentGeneralSettings.mouseSensitivity; }
 26
 27        public override void UpdateSetting(object newValue)
 28        {
 229            currentGeneralSettings.mouseSensitivity = (float)newValue;
 30
 231            var povSpeed = Mathf.Lerp(FIRST_PERSON_MIN_SPEED, FIRST_PERSON_MAX_SPEED, currentGeneralSettings.mouseSensit
 232            povCamera.m_HorizontalAxis.m_MaxSpeed = povSpeed;
 233            povCamera.m_VerticalAxis.m_MaxSpeed = povSpeed;
 234            SceneReferences.i.thirdPersonCamera.m_XAxis.m_MaxSpeed = Mathf.Lerp(THIRD_PERSON_X_MIN_SPEED, THIRD_PERSON_X
 235            SceneReferences.i.thirdPersonCamera.m_YAxis.m_MaxSpeed = Mathf.Lerp(THIRD_PERSON_Y_MIN_SPEED, THIRD_PERSON_Y
 236        }
 37    }
 38}