game(scripts): freeze player input when paused

so the camera doesnt move alongside the cursor
This commit is contained in:
sippy-thinks 2024-08-11 13:31:01 +08:00
parent d5e7a9970a
commit 0f6c739623

View file

@ -122,6 +122,7 @@ private void PauseGameHelper(DisplayState incomingState)
Time.timeScale = 0f;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
// or if the incoming state is the main menu, we should probably free the cursor
else if (incomingState == DisplayState.ScreenMainMenu)
@ -129,10 +130,13 @@ private void PauseGameHelper(DisplayState incomingState)
Debug.Log("GameManager.PauseGameHelper: freeing cursor for main menu");
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
// freeze player input/control if we're not transitioning to a game state
if (incomingState != DisplayState.Game)
{
Debug.Log(GameObject.FindGameObjectWithTag("Player"));
var playerInput = GameObject.Find("PlayerArmature")?.GetComponent<PlayerInput>();
Debug.Log($"playerController={playerInput}");
if (playerInput != null)
{
Debug.Log("GameManager.PauseGameHelper: sentencing player input/control to a ball and chain boowomp");