Implemented mouse centering and hiding in game #384
|
@ -90,11 +90,16 @@ public class GameManager : Script
|
|||
{
|
||||
if (GamePause)
|
||||
{
|
||||
Input.SetMouseCentering(false);
|
||||
Application.IsCursorVisible = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (currGameState == GameState.START)
|
||||
{
|
||||
Input.SetMouseCentering(true);
|
||||
Application.IsCursorVisible = false;
|
||||
|
||||
timer -= Time.DeltaTimeF;
|
||||
if(scoreText)
|
||||
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["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
Input.SetMouseCentering(false);
|
||||
Application.IsCursorVisible = true;
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (Input.GetKeyDown(Input.KeyCode.R))
|
||||
|
|
|
@ -23,6 +23,8 @@ public class MainMenu : Script
|
|||
|
||||
protected override void start()
|
||||
{
|
||||
Input.SetMouseCentering(false);
|
||||
Application.IsCursorVisible = true;
|
||||
}
|
||||
protected override void update()
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PauseMenu : Script
|
|||
if (GameManager.Instance.GamePause)
|
||||
{
|
||||
GameManager.Instance.GamePause = false;
|
||||
Input.SetMouseCentering(true);
|
||||
Application.IsCursorVisible = false;
|
||||
AudioHandler.PauseAllSounds(false);
|
||||
if (gamePauseText)
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||
|
@ -89,6 +91,8 @@ public class PauseMenu : Script
|
|||
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
||||
{
|
||||
GameManager.Instance.GamePause = true;
|
||||
Input.SetMouseCentering(false);
|
||||
Application.IsCursorVisible = true;
|
||||
AudioHandler.PauseAllSounds(true);
|
||||
if (gamePauseText)
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = true;
|
||||
|
|
Loading…
Reference in New Issue