Add a pausable interface and make minigameobjecs pausable
This commit is contained in:
@@ -35,6 +35,13 @@ namespace UI
|
||||
public event Action OnGamePaused;
|
||||
public event Action OnGameResumed;
|
||||
|
||||
private bool _isPaused = false;
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the game is currently paused
|
||||
/// </summary>
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Subscribe to scene loaded events
|
||||
@@ -92,6 +99,12 @@ namespace UI
|
||||
|
||||
// Change input mode to UI when menu is open
|
||||
InputManager.Instance.SetInputMode(InputMode.UI);
|
||||
|
||||
// Set paused flag and broadcast event
|
||||
_isPaused = true;
|
||||
OnGamePaused?.Invoke();
|
||||
|
||||
Debug.Log("[PauseMenu] Game Paused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,6 +121,12 @@ namespace UI
|
||||
// Change input mode back to Game when menu is closed
|
||||
if(resetInput)
|
||||
InputManager.Instance.SetInputMode(InputMode.Game);
|
||||
|
||||
// Clear paused flag and broadcast event
|
||||
_isPaused = false;
|
||||
OnGameResumed?.Invoke();
|
||||
|
||||
Debug.Log("[PauseMenu] Game Resumed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user