Clean up IPausable interafaces a little bit and start refactoring the pause-game flow in the minigame

This commit is contained in:
Michal Adam Pikulski
2025-10-23 09:31:09 +02:00
parent 35acaddca5
commit ef3b4bf369
15 changed files with 423 additions and 579 deletions

View File

@@ -59,12 +59,6 @@ namespace Minigames.DivingForPictures
private float _screenNormalizationFactor = 1.0f;
private IDivingMinigameSettings _settings;
// Pause state
private bool _isPaused = false;
// IPausable implementation
public bool IsPaused => _isPaused;
private void Awake()
{
_collider = GetComponent<Collider2D>();
@@ -124,7 +118,7 @@ namespace Minigames.DivingForPictures
private void OnEnable()
{
// Only start coroutines if not paused
if (!_isPaused)
if (!GameManager.Instance.IsPaused)
{
StartObstacleCoroutines();
}
@@ -143,9 +137,8 @@ namespace Minigames.DivingForPictures
/// </summary>
public void Pause()
{
if (_isPaused) return; // Already paused
_isPaused = true;
if (GameManager.Instance.IsPaused) return; // Already paused
StopObstacleCoroutines();
Logging.Debug($"[FloatingObstacle] Paused obstacle: {name}");
@@ -156,9 +149,8 @@ namespace Minigames.DivingForPictures
/// </summary>
public void DoResume()
{
if (!_isPaused) return; // Already running
_isPaused = false;
if (!GameManager.Instance.IsPaused) return; // Already running
StartObstacleCoroutines();
Logging.Debug($"[FloatingObstacle] Resumed obstacle: {name}");