diff --git a/Assets/Scenes/MiniGames/BirdPoop.unity b/Assets/Scenes/MiniGames/BirdPoop.unity
index ff542208..07979176 100644
--- a/Assets/Scenes/MiniGames/BirdPoop.unity
+++ b/Assets/Scenes/MiniGames/BirdPoop.unity
@@ -1691,7 +1691,7 @@ GameObject:
- component: {fileID: 1536057437}
m_Layer: 5
m_Name: MainCanvas
- m_TagString: Untagged
+ m_TagString: MainCanvas
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
diff --git a/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs b/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs
index 83a4f52e..bd4ba824 100644
--- a/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs
+++ b/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs
@@ -186,7 +186,7 @@ namespace Minigames.BirdPooper
///
/// Called when player takes damage/dies.
- /// Shows game over screen.
+ /// Pauses all game entities and starts end game sequence.
///
private void HandlePlayerDamaged()
{
@@ -210,7 +210,65 @@ namespace Minigames.BirdPooper
targetSpawner.StopSpawning();
}
- // Show game over screen
+ // Pause all existing scrolling entities (obstacles and targets)
+ PauseAllScrollingEntities();
+
+ // Start the end game sequence (show boosters, then game over screen)
+ StartCoroutine(EndGameSequence());
+ }
+
+ ///
+ /// Pause all existing scrolling entities in the scene.
+ ///
+ private void PauseAllScrollingEntities()
+ {
+ ScrollingEntity[] entities = FindObjectsByType(FindObjectsSortMode.None);
+ foreach (ScrollingEntity entity in entities)
+ {
+ entity.Pause();
+ }
+ Debug.Log($"[BirdPooperGameManager] Paused {entities.Length} scrolling entities");
+ }
+
+ ///
+ /// End game sequence: award boosters, wait for completion, then show game over screen.
+ ///
+ private System.Collections.IEnumerator EndGameSequence()
+ {
+ // Calculate booster reward
+ int boosterReward = CalculateBoosterReward(_targetsHit);
+
+ Debug.Log($"[BirdPooperGameManager] Targets hit: {_targetsHit}, awarding {boosterReward} booster pack(s)");
+
+ // Show booster pack reward UI and wait for completion
+ if (boosterReward > 0)
+ {
+ Debug.Log("[BirdPooperGameManager] Starting booster giver sequence via GameManager");
+
+ var task = Core.GameManager.Instance.GiveBoosterPacksAsync(boosterReward);
+
+ // Wait for the task to complete
+ while (!task.IsCompleted)
+ {
+ yield return null;
+ }
+
+ // Check for exceptions
+ if (task.IsFaulted)
+ {
+ Debug.LogWarning($"[BirdPooperGameManager] Booster pack reward failed: {task.Exception?.GetBaseException().Message}");
+ }
+ else
+ {
+ Debug.Log("[BirdPooperGameManager] Booster giver sequence finished, proceeding to game over screen");
+ }
+ }
+ else
+ {
+ Debug.Log("[BirdPooperGameManager] No boosters to award, proceeding directly to game over screen");
+ }
+
+ // Now show game over screen
if (gameOverScreen != null)
{
gameOverScreen.Show();
@@ -221,6 +279,23 @@ namespace Minigames.BirdPooper
}
}
+ ///
+ /// Calculate booster pack reward based on targets hit.
+ /// Rules:
+ /// - First booster pack is given for simply playing the game (participation reward)
+ /// - Every 3 hit targets gives 1 additional booster pack
+ ///
+ private int CalculateBoosterReward(int targetsHit)
+ {
+ // Base reward: 1 booster for participation
+ int reward = 1;
+
+ // Additional reward: 1 booster per 3 targets hit
+ reward += targetsHit / 3;
+
+ return reward;
+ }
+
///
/// Spawns a poop projectile at the player's current position.
/// Called by UI button OnClick event.
diff --git a/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs b/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs
index a536dd22..75cfb26f 100644
--- a/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs
+++ b/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs
@@ -2,14 +2,12 @@
using UnityEngine;
using UnityEngine.UI;
using Core;
-using UI;
namespace Minigames.BirdPooper
{
///
/// Game over screen for Bird Pooper minigame.
/// Displays when the player dies and allows restarting the level.
- /// Uses unscaled time for UI updates (works when Time.timeScale = 0).
///
public class GameOverScreen : MonoBehaviour
{
@@ -53,7 +51,7 @@ namespace Minigames.BirdPooper
}
///
- /// Show the game over screen and pause the game.
+ /// Show the game over screen.
///
public void Show()
{
@@ -67,11 +65,7 @@ namespace Minigames.BirdPooper
canvasGroup.blocksRaycasts = true;
}
- // Pause the game (set timescale to 0)
- // PauseMenu uses unscaled time for tweens, so it will still work
- Time.timeScale = 0f;
-
- Debug.Log("[GameOverScreen] Game Over - Time.timeScale set to 0");
+ Debug.Log("[GameOverScreen] Game Over screen shown");
}
///
@@ -89,8 +83,6 @@ namespace Minigames.BirdPooper
}
gameObject.SetActive(false);
- // Reset time scale BEFORE reloading
- Time.timeScale = 1f;
var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
await SceneManagerService.Instance.ReloadCurrentScene(progress);
}
diff --git a/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs b/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs
index 1bd72e49..88854c46 100644
--- a/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs
+++ b/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs
@@ -21,6 +21,7 @@ namespace Minigames.BirdPooper
protected IBirdPooperSettings settings;
protected float despawnXPosition;
protected bool isInitialized;
+ protected bool isPaused;
protected EdgeAnchor edgeAnchor;
///
@@ -191,12 +192,33 @@ namespace Minigames.BirdPooper
protected virtual void Update()
{
- if (!isInitialized || settings == null) return;
+ if (!isInitialized || settings == null || isPaused) return;
MoveLeft();
CheckBounds();
}
+ ///
+ /// Pause the scrolling movement of this entity.
+ ///
+ public void Pause()
+ {
+ isPaused = true;
+ }
+
+ ///
+ /// Resume the scrolling movement of this entity.
+ ///
+ public void Resume()
+ {
+ isPaused = false;
+ }
+
+ ///
+ /// Check if this entity is currently paused.
+ ///
+ public bool IsPaused => isPaused;
+
///
/// Move entity left at constant speed (manual movement, no physics).
/// Override GetMoveSpeed() to customize speed per entity type.