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

@@ -29,12 +29,6 @@ namespace Minigames.DivingForPictures
private Coroutine _wobbleCoroutine;
private Coroutine _offScreenCheckCoroutine;
// Pause state tracking
private bool _isPaused = false;
// IPausable implementation
public bool IsPaused => _isPaused;
void Awake()
{
// Cache references and randomize time offset for wobble
@@ -67,9 +61,8 @@ namespace Minigames.DivingForPictures
/// </summary>
public void Pause()
{
if (_isPaused) return; // Already paused
_isPaused = true;
if (GameManager.Instance.IsPaused) return; // Already paused
StopBubbleBehavior();
// Debug log for troubleshooting
@@ -81,9 +74,8 @@ namespace Minigames.DivingForPictures
/// </summary>
public void DoResume()
{
if (!_isPaused) return; // Already running
_isPaused = false;
if (!GameManager.Instance.IsPaused) return; // Already running
StartBubbleBehavior();
// Debug log for troubleshooting
@@ -95,7 +87,7 @@ namespace Minigames.DivingForPictures
/// </summary>
private void StartBubbleBehavior()
{
if (_isPaused || !isActiveAndEnabled) return; // Don't start if paused
if (GameManager.Instance.IsPaused || !isActiveAndEnabled) return; // Don't start if paused
_movementCoroutine = StartCoroutine(MovementCoroutine());
_wobbleCoroutine = StartCoroutine(WobbleCoroutine());