Implemented mouse centering and hiding in game #384

Merged
mushgunAX merged 9 commits from SP3-10-input-management into main 2023-03-03 18:29:54 +08:00
3 changed files with 5 additions and 4 deletions
Showing only changes of commit 4131c58c08 - Show all commits

View File

@ -84,6 +84,7 @@ public class GameManager : Script
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
Application.IsCursorVisible = false;
}
protected override void update()
@ -91,15 +92,14 @@ public class GameManager : Script
if (GamePause)
{
Input.SetMouseCentering(false);
Application.IsCursorVisible = true;
//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}";

View File

@ -16,6 +16,7 @@ public class EndScene : Script
protected override void start()
{
Input.SetMouseCentering(false);
Debug.Log("EndScene::Start():");
Application.IsCursorVisible = true;
}

View File

@ -88,7 +88,7 @@ public class PauseMenu : Script
protected override void update()
{
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
if (Input.GetKeyUp(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
{
GameManager.Instance.GamePause = true;
Input.SetMouseCentering(false);