mouse centering and visibility when appropriate
This commit is contained in:
parent
b63db13c41
commit
a04eee0a2f
|
@ -90,11 +90,16 @@ public class GameManager : Script
|
||||||
{
|
{
|
||||||
if (GamePause)
|
if (GamePause)
|
||||||
{
|
{
|
||||||
|
Input.SetMouseCentering(false);
|
||||||
|
Application.IsCursorVisible = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currGameState == GameState.START)
|
if (currGameState == GameState.START)
|
||||||
{
|
{
|
||||||
|
Input.SetMouseCentering(true);
|
||||||
|
Application.IsCursorVisible = false;
|
||||||
|
|
||||||
timer -= Time.DeltaTimeF;
|
timer -= Time.DeltaTimeF;
|
||||||
if(scoreText)
|
if(scoreText)
|
||||||
scoreText.GetComponent<TextRenderable>().Text = $"Score: {Score}";
|
scoreText.GetComponent<TextRenderable>().Text = $"Score: {Score}";
|
||||||
|
|
|
@ -12,6 +12,13 @@ public class EndScene : Script
|
||||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
Input.SetMouseCentering(false);
|
||||||
|
Application.IsCursorVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(Input.KeyCode.R))
|
if (Input.GetKeyDown(Input.KeyCode.R))
|
||||||
|
|
|
@ -23,6 +23,8 @@ public class MainMenu : Script
|
||||||
|
|
||||||
protected override void start()
|
protected override void start()
|
||||||
{
|
{
|
||||||
|
Input.SetMouseCentering(false);
|
||||||
|
Application.IsCursorVisible = true;
|
||||||
}
|
}
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class PauseMenu : Script
|
||||||
if (GameManager.Instance.GamePause)
|
if (GameManager.Instance.GamePause)
|
||||||
{
|
{
|
||||||
GameManager.Instance.GamePause = false;
|
GameManager.Instance.GamePause = false;
|
||||||
|
Input.SetMouseCentering(true);
|
||||||
|
Application.IsCursorVisible = false;
|
||||||
AudioHandler.PauseAllSounds(false);
|
AudioHandler.PauseAllSounds(false);
|
||||||
if (gamePauseText)
|
if (gamePauseText)
|
||||||
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||||
|
@ -89,6 +91,8 @@ public class PauseMenu : Script
|
||||||
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
||||||
{
|
{
|
||||||
GameManager.Instance.GamePause = true;
|
GameManager.Instance.GamePause = true;
|
||||||
|
Input.SetMouseCentering(false);
|
||||||
|
Application.IsCursorVisible = true;
|
||||||
AudioHandler.PauseAllSounds(true);
|
AudioHandler.PauseAllSounds(true);
|
||||||
if (gamePauseText)
|
if (gamePauseText)
|
||||||
gamePauseText.GetComponent<TextRenderable>().Enabled = true;
|
gamePauseText.GetComponent<TextRenderable>().Enabled = true;
|
||||||
|
|
Loading…
Reference in New Issue