Add a pausable interface and make minigameobjecs pausable

This commit is contained in:
Michal Pikulski
2025-10-08 12:36:08 +02:00
parent 3807ac652c
commit 0e17516df7
11 changed files with 1101 additions and 395 deletions

View File

@@ -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>