-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maroon-568 [Settings] Add Mouse Sensitivity setting (#576)
* Add Settings column * Add controls premenuColumn * Add scrMenuColumnControls * MainMenu add settings instead of language/audio * Simplify code * Pause menu now also uses settings instead of audio/Language * Fix controls title * Add new bootstrap icons for settings and controls and mouse sensitivity * Add ControlsManager GlobalEntity * Changing mouse sensitivity now working * Fix failing unit tests * Add new ControlsMenu tests * Mouse Sensitivity silder now uses logarithmic range * Adjust unit tests * Changed MIN_MOUSE_SENSITIVITY from 20 to 50 --------- Co-authored-by: Florian Wohlmuth <[email protected]>
- Loading branch information
1 parent
dcf5b0e
commit 23ee716
Showing
37 changed files
with
3,111 additions
and
728 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
unity/Assets/Maroon/GlobalEntities/ControlsManager/ControlsManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using UnityEngine; | ||
|
||
namespace Maroon.GlobalEntities.ControlsManager | ||
{ | ||
/// <summary> | ||
/// Handles settings related to controls in Maroon. | ||
/// e.g. Mouse sensitivity | ||
/// </summary> | ||
public class ControlsManager : MonoBehaviour, GlobalEntity | ||
{ | ||
private static ControlsManager _instance = null; | ||
/// <summary> | ||
/// The ControlsManager instance | ||
/// </summary> | ||
public static ControlsManager Instance => ControlsManager._instance; | ||
MonoBehaviour GlobalEntity.Instance => Instance; | ||
|
||
|
||
private float _mouseSensitivity = 200f; | ||
/// <summary> | ||
/// The sensitivity of the mouse for first-person controls, e.g. when looking around in the laboratory. | ||
/// </summary> | ||
public float MouseSensitivity | ||
{ | ||
get { return _mouseSensitivity; } | ||
set { _mouseSensitivity = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Called by Unity. Initializes singleton instance and DontDestroyOnLoad (stays active on new scene load). | ||
/// </summary> | ||
private void Awake() | ||
{ | ||
// Singleton | ||
if(ControlsManager._instance == null) | ||
{ | ||
ControlsManager._instance = this; | ||
} | ||
else if(ControlsManager._instance != this) | ||
{ | ||
DestroyImmediate(this.gameObject); | ||
return; | ||
} | ||
|
||
// Keep alive | ||
this.transform.parent = null; | ||
DontDestroyOnLoad(this.gameObject); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
unity/Assets/Maroon/GlobalEntities/ControlsManager/ControlsManager.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
unity/Assets/Maroon/GlobalEntities/ControlsManager/ControlsManager.prefab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &4398862966192869678 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 4398862966192869714} | ||
- component: {fileID: 641600007337123814} | ||
m_Layer: 0 | ||
m_Name: ControlsManager | ||
m_TagString: GlobalEntity | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &4398862966192869714 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4398862966192869678} | ||
serializedVersion: 2 | ||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!114 &641600007337123814 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 4398862966192869678} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: de7690d93ceea354f845306e19e07c59, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
_uiPrimary: {fileID: 0} | ||
_uiInfo: {fileID: 0} | ||
_uiSuccess: {fileID: 0} | ||
_uiWarning: {fileID: 0} | ||
_uiDanger: {fileID: 0} |
7 changes: 7 additions & 0 deletions
7
unity/Assets/Maroon/GlobalEntities/ControlsManager/ControlsManager.prefab.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...Assets/Maroon/GlobalEntities/ControlsManager/Maroon.GlobalEntities.ControlsManager.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Maroon.GlobalEntities.ControlsManager", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:ccf513c02a7c0734f97bf699ec9fcc75" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
...s/Maroon/GlobalEntities/ControlsManager/Maroon.GlobalEntities.ControlsManager.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.