Revamp game pausing and input handling. Fix minigame tutorial and end sequence. (#39)
- Revamp pausing and centralize management in GameManager - Switch Pause implementation to be counter-based to solve corner case of multiple pause requests - Remove duplicated Pause logic from other components - Add pausing when browsing the card album - Fully deliver the exclusive UI implementation - Spruce up the MiniGame tutorial with correct pausing, hiding other UI - Correctly unpause after showing tutorial - Fix minigame ending sequence. The cinematic correctly plays only once now - Replaying the minigame works Co-authored-by: Michal Adam Pikulski <michal@foolhardyhorizons.com> Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com> Reviewed-on: #39
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Settings;
|
||||
using Utils;
|
||||
using AppleHills.Core.Interfaces;
|
||||
@@ -113,12 +111,6 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
// Pause state
|
||||
private bool _isPaused = false;
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_mainCamera = UnityEngine.Camera.main;
|
||||
@@ -193,10 +185,6 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
|
||||
// Stop all active coroutines but save their references
|
||||
if (_movementCoroutine != null)
|
||||
{
|
||||
@@ -230,10 +218,6 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void DoResume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
|
||||
// Restart all necessary coroutines
|
||||
StartMovementCoroutine();
|
||||
StartTileDestructionCoroutine();
|
||||
@@ -500,7 +484,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private void StartMovementCoroutine()
|
||||
{
|
||||
if (_movementCoroutine == null && !_isPaused)
|
||||
if (_movementCoroutine == null && !GameManager.Instance.IsPaused)
|
||||
{
|
||||
_movementCoroutine = StartCoroutine(MoveActiveTilesRoutine());
|
||||
}
|
||||
@@ -513,7 +497,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
Logging.Debug($"[TrenchTileSpawner] Started movement coroutine with normalized speed: {_baseMoveSpeed:F3}");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
while (enabled && gameObject.activeInHierarchy && !GameManager.Instance.IsPaused)
|
||||
{
|
||||
// Skip if no active tiles
|
||||
if (_activeTiles.Count == 0)
|
||||
@@ -554,7 +538,7 @@ namespace Minigames.DivingForPictures
|
||||
const float checkInterval = 1.0f; // Check once per second
|
||||
Logging.Debug($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
while (enabled && gameObject.activeInHierarchy && !GameManager.Instance.IsPaused)
|
||||
{
|
||||
// Increase the base move speed up to the maximum
|
||||
_baseMoveSpeed = Mathf.Min(_baseMoveSpeed + _settings.SpeedUpFactor, _settings.MaxNormalizedMoveSpeed);
|
||||
|
||||
Reference in New Issue
Block a user