Skip to content

Commit bdfd4f0

Browse files
committed
chore: Improve key and var naming in pause manager
1 parent 5ff0e1e commit bdfd4f0

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Assets/JCSUnity/Scripts/Managers/JCS_PauseManager.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@ public class JCS_PauseManager : JCS_Manager<JCS_PauseManager>
4141

4242
[Tooltip("Key that increment the time.")]
4343
[SerializeField]
44-
private KeyCode mIncTime = KeyCode.N;
44+
private KeyCode mKeyInc = KeyCode.M;
4545

4646
[Tooltip("Key that decrement the time.")]
4747
[SerializeField]
48-
private KeyCode mDecTime = KeyCode.M;
48+
private KeyCode mKeyDec = KeyCode.N;
49+
50+
[Tooltip("Key that decrement the time.")]
51+
[SerializeField]
52+
private KeyCode mKeyReset = KeyCode.B;
4953

5054
[Tooltip("Delta value to add to the time.")]
5155
[SerializeField]
52-
[Range(0.0f, 100.0f)]
53-
private float mTimeDelta = 5.0f;
56+
[Range(0.001f, 100.0f)]
57+
private float mTimeDelta = 0.1f;
5458
#endif
5559

5660
[Separator("Check Variables (JCS_PauseManager)")]
@@ -129,33 +133,37 @@ private void Update()
129133
#if UNITY_EDITOR
130134
mTimeScale = Time.timeScale;
131135

132-
TestPauseGame();
136+
Test();
133137
#endif
134138

135139
ResizePauseActionListPeriodically();
136140
DoAsymp();
137141
}
138142

139143
#if UNITY_EDITOR
140-
private void TestPauseGame()
144+
private void Test()
141145
{
142146
if (!mTest)
143147
return;
144148

145-
if (Input.GetKeyDown(mToggleGamePause))
149+
if (Input.GetKeyUp(mToggleGamePause))
146150
{
147151
var gm = JCS_GameManager.FirstInstance();
148152

149153
gm.gamePaused = !gm.gamePaused;
150154
}
151155

152-
if (Input.GetKeyDown(mIncTime))
156+
if (Input.GetKeyUp(mKeyReset))
157+
{
158+
mTargetTimeScale = mDefaultTimeScale;
159+
}
160+
else if (Input.GetKeyUp(mKeyInc))
153161
{
154162
Time.timeScale += mTimeDelta;
155163

156164
mTargetTimeScale = Time.timeScale;
157165
}
158-
else if (Input.GetKeyDown(mDecTime))
166+
else if (Input.GetKeyUp(mKeyDec))
159167
{
160168
Time.timeScale -= mTimeDelta;
161169

0 commit comments

Comments
 (0)