Strip debug logging from the game, fix screen weirdness
This commit is contained in:
@@ -8,6 +8,7 @@ using UnityEngine.Playables;
|
||||
using AppleHills.Core.Settings;
|
||||
using Utility;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using Core;
|
||||
using Input;
|
||||
using UI;
|
||||
using Minigames.DivingForPictures.PictureCamera;
|
||||
@@ -144,11 +145,11 @@ namespace Minigames.DivingForPictures
|
||||
pauseMenu.OnGamePaused += Pause;
|
||||
pauseMenu.OnGameResumed += DoResume;
|
||||
|
||||
Debug.Log("[DivingGameManager] Subscribed to PauseMenu events");
|
||||
Logging.Debug("[DivingGameManager] Subscribed to PauseMenu events");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[DivingGameManager] PauseMenu not found. Pause functionality won't work properly.");
|
||||
Logging.Warning("[DivingGameManager] PauseMenu not found. Pause functionality won't work properly.");
|
||||
}
|
||||
|
||||
// Register this manager with the global GameManager
|
||||
@@ -161,6 +162,7 @@ namespace Minigames.DivingForPictures
|
||||
if (SceneOrientationEnforcer.Instance != null)
|
||||
{
|
||||
SceneOrientationEnforcer.Instance.OnOrientationCorrect += InitializeGame;
|
||||
SceneOrientationEnforcer.Instance.OnOrientationIncorrect += Pause;
|
||||
|
||||
// If orientation is already correct, initialize right away
|
||||
// This prevents issues if the orientation was already correct before subscription
|
||||
@@ -171,7 +173,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[DivingGameManager] SceneOrientationEnforcer not found. Initializing game immediately.");
|
||||
Logging.Warning("[DivingGameManager] SceneOrientationEnforcer not found. Initializing game immediately.");
|
||||
InitializeGame();
|
||||
}
|
||||
|
||||
@@ -210,6 +212,7 @@ namespace Minigames.DivingForPictures
|
||||
if (SceneOrientationEnforcer.Instance != null)
|
||||
{
|
||||
SceneOrientationEnforcer.Instance.OnOrientationCorrect -= InitializeGame;
|
||||
SceneOrientationEnforcer.Instance.OnOrientationIncorrect -= Pause;
|
||||
}
|
||||
|
||||
// Unsubscribe from PauseMenu events
|
||||
@@ -294,11 +297,11 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
private void SpawnMonster(Transform spawnPoint)
|
||||
{
|
||||
Debug.Log("Spawning monster: " + spawnPoint.name);
|
||||
Logging.Debug("Spawning monster: " + spawnPoint.name);
|
||||
|
||||
if (monsterPrefabs.Length == 0)
|
||||
{
|
||||
Debug.LogWarning("No monster prefabs assigned to DivingGameManager.");
|
||||
Logging.Warning("No monster prefabs assigned to DivingGameManager.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -359,7 +362,7 @@ namespace Minigames.DivingForPictures
|
||||
int remainingRopes = playerRopes.Length - currentRopeIndex;
|
||||
OnRopeBroken?.Invoke(remainingRopes);
|
||||
|
||||
Debug.Log($"[DivingGameManager] Rope broken! {remainingRopes} ropes remaining.");
|
||||
Logging.Debug($"[DivingGameManager] Rope broken! {remainingRopes} ropes remaining.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +382,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"[DivingGameManager] Rope at index {currentRopeIndex} is null!");
|
||||
Logging.Warning($"[DivingGameManager] Rope at index {currentRopeIndex} is null!");
|
||||
}
|
||||
|
||||
// Move to the next rope regardless if current was null
|
||||
@@ -406,7 +409,7 @@ namespace Minigames.DivingForPictures
|
||||
if (isGameOver) return;
|
||||
|
||||
isGameOver = true;
|
||||
Debug.Log("[DivingGameManager] Game Over! All ropes broken. Starting surfacing sequence...");
|
||||
Logging.Debug("[DivingGameManager] Game Over! All ropes broken. Starting surfacing sequence...");
|
||||
|
||||
// Fire game over event
|
||||
OnGameOver?.Invoke();
|
||||
@@ -422,7 +425,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
if (playerRopes == null || playerRopes.Length == 0)
|
||||
{
|
||||
Debug.LogWarning("[DivingGameManager] No ropes assigned to break! Damage system won't work properly.");
|
||||
Logging.Warning("[DivingGameManager] No ropes assigned to break! Damage system won't work properly.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -430,7 +433,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
if (playerRopes[i] == null)
|
||||
{
|
||||
Debug.LogWarning($"[DivingGameManager] Rope at index {i} is null!");
|
||||
Logging.Warning($"[DivingGameManager] Rope at index {i} is null!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,7 +459,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[DivingGameManager] Rope system reset.");
|
||||
Logging.Debug("[DivingGameManager] Rope system reset.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -510,7 +513,7 @@ namespace Minigames.DivingForPictures
|
||||
// Start coroutine to animate the rock falling offscreen
|
||||
StartCoroutine(MoveRockOffscreen(rockObject.transform));
|
||||
|
||||
Debug.Log("[DivingGameManager] Disabled rock components and animating it offscreen");
|
||||
Logging.Debug("[DivingGameManager] Disabled rock components and animating it offscreen");
|
||||
}
|
||||
|
||||
// Handle the Player object - disable components and reset X position
|
||||
@@ -534,7 +537,7 @@ namespace Minigames.DivingForPictures
|
||||
// Start coroutine to reset X position to 0 over 1 second
|
||||
StartCoroutine(ResetPlayerPosition(playerObject.transform));
|
||||
|
||||
Debug.Log("[DivingGameManager] Disabled player components (keeping Animator and PlayerBlinkBehavior) and resetting position");
|
||||
Logging.Debug("[DivingGameManager] Disabled player components (keeping Animator and PlayerBlinkBehavior) and resetting position");
|
||||
}
|
||||
|
||||
// 3. Find bubble spawner and slow down existing bubbles (no velocity management needed)
|
||||
@@ -566,7 +569,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
surfacingSequenceCoroutine = StartCoroutine(SurfacingSequence());
|
||||
|
||||
Debug.Log($"[DivingGameManager] Started surfacing with target velocity factor: {targetVelocityFactor}");
|
||||
Logging.Debug($"[DivingGameManager] Started surfacing with target velocity factor: {targetVelocityFactor}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -580,7 +583,7 @@ namespace Minigames.DivingForPictures
|
||||
UnityEngine.Camera mainCamera = UnityEngine.Camera.main;
|
||||
if (mainCamera == null)
|
||||
{
|
||||
Debug.LogWarning("[DivingGameManager] Cannot find main camera to calculate offscreen position");
|
||||
Logging.Warning("[DivingGameManager] Cannot find main camera to calculate offscreen position");
|
||||
yield break;
|
||||
}
|
||||
|
||||
@@ -648,7 +651,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
// Tell it to stop spawning new tiles
|
||||
tileSpawner.StopSpawning();
|
||||
Debug.Log("[DivingGameManager] Stopped spawning new tiles after delay");
|
||||
Logging.Debug("[DivingGameManager] Stopped spawning new tiles after delay");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,11 +664,11 @@ namespace Minigames.DivingForPictures
|
||||
if (surfacingTimeline != null)
|
||||
{
|
||||
surfacingTimeline.Play();
|
||||
Debug.Log("[DivingGameManager] Last tile left the screen, playing timeline");
|
||||
Logging.Debug("[DivingGameManager] Last tile left the screen, playing timeline");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[DivingGameManager] No surfacing timeline assigned!");
|
||||
Logging.Warning("[DivingGameManager] No surfacing timeline assigned!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,7 +687,7 @@ namespace Minigames.DivingForPictures
|
||||
activeMonsters.Clear();
|
||||
|
||||
// Final score could be saved to player prefs or other persistence
|
||||
Debug.Log($"Final Score: {playerScore}");
|
||||
Logging.Debug($"Final Score: {playerScore}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -747,7 +750,7 @@ namespace Minigames.DivingForPictures
|
||||
component.Pause();
|
||||
}
|
||||
|
||||
Debug.Log($"[DivingGameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
Logging.Debug($"[DivingGameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -760,7 +763,7 @@ namespace Minigames.DivingForPictures
|
||||
if (component != null && _pausableComponents.Contains(component))
|
||||
{
|
||||
_pausableComponents.Remove(component);
|
||||
Debug.Log($"[DivingGameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
Logging.Debug($"[DivingGameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,7 +791,7 @@ namespace Minigames.DivingForPictures
|
||||
if(turnOffGameInput)
|
||||
InputManager.Instance.SetInputMode(InputMode.UI);
|
||||
|
||||
Debug.Log($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components.");
|
||||
Logging.Debug($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -809,7 +812,7 @@ namespace Minigames.DivingForPictures
|
||||
// Change input mode to UI when menu is open
|
||||
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
|
||||
|
||||
Debug.Log($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components.");
|
||||
Logging.Debug($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components.");
|
||||
}
|
||||
|
||||
#region Photo Sequence Methods
|
||||
@@ -819,7 +822,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private void OnReverseAnimationStarted()
|
||||
{
|
||||
Debug.Log("[DivingGameManager] Viewfinder animation entering reverse (zoom-out) phase");
|
||||
Logging.Debug("[DivingGameManager] Viewfinder animation entering reverse (zoom-out) phase");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -842,7 +845,7 @@ namespace Minigames.DivingForPictures
|
||||
// Store the proximity value at the time of tap for scoring
|
||||
_capturedProximity = proximity;
|
||||
|
||||
Debug.Log($"[DivingGameManager] Player tapped during animation! Proximity: {proximity:F2}");
|
||||
Logging.Debug($"[DivingGameManager] Player tapped during animation! Proximity: {proximity:F2}");
|
||||
|
||||
// Take the picture at the current proximity
|
||||
TakePicture();
|
||||
@@ -883,7 +886,7 @@ namespace Minigames.DivingForPictures
|
||||
// Calculate total score
|
||||
int pointsAwarded = settings.BasePoints + proximityBonus + depthBonus;
|
||||
|
||||
Debug.Log($"[DivingGameManager] Picture score calculation: base={proximityBonus} (proximity={proximity:F2}), " +
|
||||
Logging.Debug($"[DivingGameManager] Picture score calculation: base={proximityBonus} (proximity={proximity:F2}), " +
|
||||
$"depth bonus={depthBonus}, total={pointsAwarded}");
|
||||
|
||||
// Add score
|
||||
@@ -932,7 +935,7 @@ namespace Minigames.DivingForPictures
|
||||
_isPhotoSequenceActive = false;
|
||||
_currentPhotoTarget = null;
|
||||
|
||||
Debug.Log($"[DivingGameManager] Completed photo sequence with proximity score: {_capturedProximity:F2}");
|
||||
Logging.Debug($"[DivingGameManager] Completed photo sequence with proximity score: {_capturedProximity:F2}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -956,10 +959,16 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void InitializeGame()
|
||||
{
|
||||
if (_isGameInitialized)
|
||||
{
|
||||
DoResume();
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent double initialization
|
||||
if (_isGameInitialized) return;
|
||||
|
||||
Debug.Log("[DivingGameManager] Initializing game");
|
||||
Logging.Debug("[DivingGameManager] Initializing game");
|
||||
|
||||
// Subscribe to tile spawned event
|
||||
TrenchTileSpawner tileSpawner = FindFirstObjectByType<TrenchTileSpawner>();
|
||||
@@ -969,7 +978,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("No TrenchTileSpawner found in scene. Monster spawning won't work.");
|
||||
Logging.Warning("No TrenchTileSpawner found in scene. Monster spawning won't work.");
|
||||
}
|
||||
|
||||
// Mark as initialized
|
||||
@@ -1021,7 +1030,7 @@ namespace Minigames.DivingForPictures
|
||||
if (viewfinderManager != null)
|
||||
{
|
||||
viewfinderManager.ShowFullScreenViewfinder();
|
||||
Debug.Log($"[DivingGameManager] Player entered range of monster {monster.name}, showing full-screen viewfinder");
|
||||
Logging.Debug($"[DivingGameManager] Player entered range of monster {monster.name}, showing full-screen viewfinder");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1036,7 +1045,7 @@ namespace Minigames.DivingForPictures
|
||||
if (viewfinderManager != null)
|
||||
{
|
||||
viewfinderManager.HideViewfinder();
|
||||
Debug.Log($"[DivingGameManager] Player exited range of monster {monster.name}, hiding viewfinder");
|
||||
Logging.Debug($"[DivingGameManager] Player exited range of monster {monster.name}, hiding viewfinder");
|
||||
}
|
||||
|
||||
// Clear current target
|
||||
@@ -1052,7 +1061,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
// Pause the game immediately
|
||||
DoPause(false);
|
||||
Debug.Log($"[DivingGameManager] Pausing game before starting viewfinder animation");
|
||||
Logging.Debug($"[DivingGameManager] Pausing game before starting viewfinder animation");
|
||||
|
||||
// Mark the photo sequence as active
|
||||
_isPhotoSequenceActive = true;
|
||||
@@ -1070,7 +1079,7 @@ namespace Minigames.DivingForPictures
|
||||
if (viewfinderManager != null)
|
||||
{
|
||||
viewfinderManager.StartViewfinderSequence(_currentPhotoTarget.transform);
|
||||
Debug.Log($"[DivingGameManager] Viewfinder tapped for monster {_currentPhotoTarget.name}, starting animation sequence");
|
||||
Logging.Debug($"[DivingGameManager] Viewfinder tapped for monster {_currentPhotoTarget.name}, starting animation sequence");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user