Strip debug logging from the game, fix screen weirdness
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -72,7 +73,7 @@ namespace Minigames.DivingForPictures
|
||||
StopBubbleBehavior();
|
||||
|
||||
// Debug log for troubleshooting
|
||||
Debug.Log($"[Bubble] Paused bubble: {name}");
|
||||
Logging.Debug($"[Bubble] Paused bubble: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,7 +87,7 @@ namespace Minigames.DivingForPictures
|
||||
StartBubbleBehavior();
|
||||
|
||||
// Debug log for troubleshooting
|
||||
Debug.Log($"[Bubble] Resumed bubble: {name}");
|
||||
Logging.Debug($"[Bubble] Resumed bubble: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -195,7 +196,7 @@ namespace Minigames.DivingForPictures
|
||||
BubblePool pool = FindFirstObjectByType<BubblePool>();
|
||||
if (pool != null)
|
||||
{
|
||||
Debug.LogWarning("Bubble is missing its parent pool reference, finding pool as fallback");
|
||||
Logging.Warning("Bubble is missing its parent pool reference, finding pool as fallback");
|
||||
pool.ReturnBubble(this);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
using Pooling;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
@@ -36,7 +37,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public override void LogPoolStats()
|
||||
{
|
||||
Debug.Log($"[BubblePool] Pooled bubbles: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})");
|
||||
Logging.Debug($"[BubblePool] Pooled bubbles: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using UnityEngine;
|
||||
using AppleHills.Core.Settings;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -106,7 +107,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[BubbleSpawner] Paused");
|
||||
Logging.Debug("[BubbleSpawner] Paused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -131,7 +132,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[BubbleSpawner] Resumed");
|
||||
Logging.Debug("[BubbleSpawner] Resumed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -153,7 +154,7 @@ namespace Minigames.DivingForPictures
|
||||
if (_devSettings == null) return;
|
||||
|
||||
_nextSpawnInterval = GetRandomizedInterval();
|
||||
Debug.Log($"[BubbleSpawner] Next spawn interval set to: {_nextSpawnInterval:F2}s");
|
||||
Logging.Debug($"[BubbleSpawner] Next spawn interval set to: {_nextSpawnInterval:F2}s");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -239,7 +240,7 @@ namespace Minigames.DivingForPictures
|
||||
bubble.speed *= _devSettings.BubbleSurfacingSpeedFactor;
|
||||
}
|
||||
|
||||
Debug.Log($"[BubbleSpawner] Started surfacing mode. Bubbles slowed to {_devSettings.BubbleSurfacingSpeedFactor * 100}% speed.");
|
||||
Logging.Debug($"[BubbleSpawner] Started surfacing mode. Bubbles slowed to {_devSettings.BubbleSurfacingSpeedFactor * 100}% speed.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -258,7 +259,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private IEnumerator SpawnBubblesRoutine()
|
||||
{
|
||||
Debug.Log("[BubbleSpawner] Started bubble spawning coroutine");
|
||||
Logging.Debug("[BubbleSpawner] Started bubble spawning coroutine");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
@@ -269,7 +270,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
_spawnCoroutine = null;
|
||||
|
||||
Debug.Log("[BubbleSpawner] Bubble spawning coroutine ended");
|
||||
Logging.Debug("[BubbleSpawner] Bubble spawning coroutine ended");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -29,7 +30,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Debug.Log("Monster created: " + gameObject.name);
|
||||
Logging.Debug("Monster created: " + gameObject.name);
|
||||
|
||||
if (detectionCollider == null)
|
||||
detectionCollider = GetComponent<CircleCollider2D>();
|
||||
@@ -48,7 +49,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Debug.Log("Monster destroyed: " + gameObject.name);
|
||||
Logging.Debug("Monster destroyed: " + gameObject.name);
|
||||
}
|
||||
|
||||
private IEnumerator CheckIfOffScreen()
|
||||
|
||||
@@ -4,6 +4,7 @@ using AppleHills.Core.Settings;
|
||||
using Pooling;
|
||||
using Utils;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -84,7 +85,7 @@ namespace Minigames.DivingForPictures
|
||||
_settings = GameManager.GetSettingsObject<IDivingMinigameSettings>();
|
||||
if (_settings == null)
|
||||
{
|
||||
Debug.LogWarning("[FloatingObstacle] Could not retrieve settings, using default values");
|
||||
Logging.Warning("[FloatingObstacle] Could not retrieve settings, using default values");
|
||||
_baseMoveSpeed = moveSpeed; // Use the serialized value as fallback
|
||||
}
|
||||
else
|
||||
@@ -95,7 +96,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
// For variety, randomly assign a speed between min and max
|
||||
_baseMoveSpeed = Random.Range(minSpeed, maxSpeed);
|
||||
Debug.Log($"[FloatingObstacle] Initialized with normalized speed: {_baseMoveSpeed} (range: {minSpeed}-{maxSpeed})");
|
||||
Logging.Debug($"[FloatingObstacle] Initialized with normalized speed: {_baseMoveSpeed} (range: {minSpeed}-{maxSpeed})");
|
||||
}
|
||||
|
||||
// Calculate screen normalization factor
|
||||
@@ -117,7 +118,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
// Calculate normalization factor based on screen height
|
||||
_screenNormalizationFactor = Screen.height / referenceHeight;
|
||||
Debug.Log($"[FloatingObstacle] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})");
|
||||
Logging.Debug($"[FloatingObstacle] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})");
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -147,7 +148,7 @@ namespace Minigames.DivingForPictures
|
||||
_isPaused = true;
|
||||
StopObstacleCoroutines();
|
||||
|
||||
Debug.Log($"[FloatingObstacle] Paused obstacle: {name}");
|
||||
Logging.Debug($"[FloatingObstacle] Paused obstacle: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -160,7 +161,7 @@ namespace Minigames.DivingForPictures
|
||||
_isPaused = false;
|
||||
StartObstacleCoroutines();
|
||||
|
||||
Debug.Log($"[FloatingObstacle] Resumed obstacle: {name}");
|
||||
Logging.Debug($"[FloatingObstacle] Resumed obstacle: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -221,7 +222,7 @@ namespace Minigames.DivingForPictures
|
||||
_movementCoroutine = StartCoroutine(MovementCoroutine());
|
||||
}
|
||||
|
||||
Debug.Log($"[FloatingObstacle] {gameObject.name} velocity factor updated to {_velocityFactor:F2}, normalized speed: {moveSpeed:F2}");
|
||||
Logging.Debug($"[FloatingObstacle] {gameObject.name} velocity factor updated to {_velocityFactor:F2}, normalized speed: {moveSpeed:F2}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,7 +230,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private IEnumerator MovementCoroutine()
|
||||
{
|
||||
Debug.Log($"[FloatingObstacle] Started movement coroutine with speed: {_baseMoveSpeed:F3}");
|
||||
Logging.Debug($"[FloatingObstacle] Started movement coroutine with speed: {_baseMoveSpeed:F3}");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
{
|
||||
@@ -273,7 +274,7 @@ namespace Minigames.DivingForPictures
|
||||
if (_collider != null && _collider.enabled)
|
||||
{
|
||||
_collider.enabled = false;
|
||||
Debug.Log($"[FloatingObstacle] Obstacle {gameObject.name} hit player - collider disabled");
|
||||
Logging.Debug($"[FloatingObstacle] Obstacle {gameObject.name} hit player - collider disabled");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,12 +300,12 @@ namespace Minigames.DivingForPictures
|
||||
// Use a larger buffer to ensure obstacles are truly off-screen before returning to pool
|
||||
if (transform.position.y > _screenTop + 5f)
|
||||
{
|
||||
Debug.Log($"[FloatingObstacle] {gameObject.name} off-screen at Y:{transform.position.y:F2}, screen top:{_screenTop:F2}");
|
||||
Logging.Debug($"[FloatingObstacle] {gameObject.name} off-screen at Y:{transform.position.y:F2}, screen top:{_screenTop:F2}");
|
||||
ReturnToPool();
|
||||
}
|
||||
else if (transform.position.y < _screenBottom - 5f) // Added check for bottom screen edge
|
||||
{
|
||||
Debug.Log($"[FloatingObstacle] {gameObject.name} below screen at Y:{transform.position.y:F2}, screen bottom:{_screenBottom:F2}");
|
||||
Logging.Debug($"[FloatingObstacle] {gameObject.name} below screen at Y:{transform.position.y:F2}, screen bottom:{_screenBottom:F2}");
|
||||
ReturnToPool();
|
||||
}
|
||||
}
|
||||
@@ -328,14 +329,14 @@ namespace Minigames.DivingForPictures
|
||||
ObstacleSpawner foundSpawner = FindFirstObjectByType<ObstacleSpawner>();
|
||||
if (foundSpawner != null)
|
||||
{
|
||||
Debug.LogWarning($"[FloatingObstacle] Obstacle {gameObject.name} lost spawner reference, found replacement spawner");
|
||||
Logging.Warning($"[FloatingObstacle] Obstacle {gameObject.name} lost spawner reference, found replacement spawner");
|
||||
spawner = foundSpawner;
|
||||
spawner.ReturnObstacleToPool(gameObject, prefabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No spawner found - just deactivate the object instead of destroying it
|
||||
Debug.LogWarning($"[FloatingObstacle] No spawner found for {gameObject.name}, deactivating safely");
|
||||
Logging.Warning($"[FloatingObstacle] No spawner found for {gameObject.name}, deactivating safely");
|
||||
gameObject.SetActive(false);
|
||||
|
||||
// Move to a safe location to avoid interference
|
||||
@@ -368,7 +369,7 @@ namespace Minigames.DivingForPictures
|
||||
_collider.enabled = true;
|
||||
}
|
||||
|
||||
Debug.Log($"[FloatingObstacle] Obstacle {gameObject.name} spawned from pool");
|
||||
Logging.Debug($"[FloatingObstacle] Obstacle {gameObject.name} spawned from pool");
|
||||
|
||||
// Note: Don't start coroutines here - OnEnable() will handle that when SetActive(true) is called
|
||||
}
|
||||
@@ -387,7 +388,7 @@ namespace Minigames.DivingForPictures
|
||||
_collider.enabled = true;
|
||||
}
|
||||
|
||||
Debug.Log($"[FloatingObstacle] Obstacle {gameObject.name} despawned to pool");
|
||||
Logging.Debug($"[FloatingObstacle] Obstacle {gameObject.name} despawned to pool");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -427,7 +428,7 @@ namespace Minigames.DivingForPictures
|
||||
// Reverse movement speed (already handled by ObstacleSpawner, but this ensures consistency)
|
||||
moveSpeed *= -1;
|
||||
|
||||
Debug.Log($"[FloatingObstacle] {gameObject.name} started surfacing with speed: {moveSpeed}");
|
||||
Logging.Debug($"[FloatingObstacle] {gameObject.name} started surfacing with speed: {moveSpeed}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
using Pooling;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
@@ -21,12 +22,12 @@ namespace Minigames.DivingForPictures
|
||||
FloatingObstacle obstacleComponent = obstacle.GetComponent<FloatingObstacle>();
|
||||
if (obstacleComponent != null)
|
||||
{
|
||||
Debug.Log($"[ObstaclePool] Returning obstacle {obstacle.name} to pool");
|
||||
Logging.Debug($"[ObstaclePool] Returning obstacle {obstacle.name} to pool");
|
||||
Return(obstacleComponent, prefabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"Attempted to return a GameObject without a FloatingObstacle component: {obstacle.name}");
|
||||
Logging.Warning($"Attempted to return a GameObject without a FloatingObstacle component: {obstacle.name}");
|
||||
Destroy(obstacle);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +39,7 @@ namespace Minigames.DivingForPictures
|
||||
/// <returns>An obstacle instance ready to use</returns>
|
||||
public GameObject GetObstacle(int prefabIndex)
|
||||
{
|
||||
Debug.Log($"[ObstaclePool] GetObstacle called for prefab index {prefabIndex}");
|
||||
Logging.Debug($"[ObstaclePool] GetObstacle called for prefab index {prefabIndex}");
|
||||
FloatingObstacle obstacleComponent = Get(prefabIndex);
|
||||
|
||||
if (obstacleComponent == null)
|
||||
@@ -47,7 +48,7 @@ namespace Minigames.DivingForPictures
|
||||
return null;
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstaclePool] Get() returned obstacle {obstacleComponent.name}, active state: {obstacleComponent.gameObject.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstaclePool] Get() returned obstacle {obstacleComponent.name}, active state: {obstacleComponent.gameObject.activeInHierarchy}");
|
||||
return obstacleComponent.gameObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using UnityEngine.Events;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Settings;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -119,7 +120,7 @@ namespace Minigames.DivingForPictures
|
||||
StartMoveCoroutine();
|
||||
StartDespawnCoroutine();
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Initialized");
|
||||
Logging.Debug("[ObstacleSpawner] Initialized");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -151,7 +152,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Paused with {_activeObstacles.Count} active obstacles");
|
||||
Logging.Debug($"[ObstacleSpawner] Paused with {_activeObstacles.Count} active obstacles");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -182,7 +183,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Resumed with {_activeObstacles.Count} active obstacles");
|
||||
Logging.Debug($"[ObstacleSpawner] Resumed with {_activeObstacles.Count} active obstacles");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -232,14 +233,14 @@ namespace Minigames.DivingForPictures
|
||||
// Check if the prefab has a FloatingObstacle component
|
||||
if (obstaclePrefabs[i].GetComponent<FloatingObstacle>() == null)
|
||||
{
|
||||
Debug.LogWarning($"Obstacle prefab {obstaclePrefabs[i].name} does not have a FloatingObstacle component. Adding one automatically.");
|
||||
Logging.Warning($"Obstacle prefab {obstaclePrefabs[i].name} does not have a FloatingObstacle component. Adding one automatically.");
|
||||
obstaclePrefabs[i].AddComponent<FloatingObstacle>();
|
||||
}
|
||||
|
||||
// Ensure the prefab is on the correct layer (using configurable obstacleLayer)
|
||||
if (obstaclePrefabs[i].layer != _devSettings.ObstacleLayer)
|
||||
{
|
||||
Debug.LogWarning($"Obstacle prefab {obstaclePrefabs[i].name} is not on the configured obstacle layer ({_devSettings.ObstacleLayer}). Setting layer automatically.");
|
||||
Logging.Warning($"Obstacle prefab {obstaclePrefabs[i].name} is not on the configured obstacle layer ({_devSettings.ObstacleLayer}). Setting layer automatically.");
|
||||
SetLayerRecursively(obstaclePrefabs[i], _devSettings.ObstacleLayer);
|
||||
}
|
||||
}
|
||||
@@ -319,7 +320,7 @@ namespace Minigames.DivingForPictures
|
||||
// Calculate spawn range based on 80% of screen width (40% on each side from center)
|
||||
_spawnRangeX = (screenWidth * 0.8f) / 2f;
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Screen calculated - Width: {screenWidth:F2}, Bottom: {_screenBottom:F2}, Spawn Range X: ±{_spawnRangeX:F2}");
|
||||
Logging.Debug($"[ObstacleSpawner] Screen calculated - Width: {screenWidth:F2}, Bottom: {_screenBottom:F2}, Spawn Range X: ±{_spawnRangeX:F2}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -330,7 +331,7 @@ namespace Minigames.DivingForPictures
|
||||
if (_spawnCoroutine == null)
|
||||
{
|
||||
_spawnCoroutine = StartCoroutine(SpawnObstaclesCoroutine());
|
||||
Debug.Log("[ObstacleSpawner] Started spawning obstacles");
|
||||
Logging.Debug("[ObstacleSpawner] Started spawning obstacles");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +344,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
StopCoroutine(_spawnCoroutine);
|
||||
_spawnCoroutine = null;
|
||||
Debug.Log("[ObstacleSpawner] Stopped spawning obstacles");
|
||||
Logging.Debug("[ObstacleSpawner] Stopped spawning obstacles");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,15 +376,15 @@ namespace Minigames.DivingForPictures
|
||||
// Don't spawn new obstacles when surfacing
|
||||
if (_isSurfacing)
|
||||
{
|
||||
Debug.Log("[ObstacleSpawner] Skipping obstacle spawn - currently surfacing");
|
||||
Logging.Debug("[ObstacleSpawner] Skipping obstacle spawn - currently surfacing");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] TrySpawnObstacle called at {Time.time:F2}");
|
||||
Logging.Debug($"[ObstacleSpawner] TrySpawnObstacle called at {Time.time:F2}");
|
||||
|
||||
if (obstaclePrefabs == null || obstaclePrefabs.Count == 0)
|
||||
{
|
||||
Debug.LogWarning("[ObstacleSpawner] No obstacle prefabs available for spawning!");
|
||||
Logging.Warning("[ObstacleSpawner] No obstacle prefabs available for spawning!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -397,20 +398,20 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
if (IsValidSpawnPosition(spawnPosition))
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] Found valid position at {spawnPosition} after {attempts + 1} attempts");
|
||||
Logging.Debug($"[ObstacleSpawner] Found valid position at {spawnPosition} after {attempts + 1} attempts");
|
||||
SpawnObstacleAt(spawnPosition);
|
||||
foundValidPosition = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] Position {spawnPosition} invalid (attempt {attempts + 1}/{_settings.ObstacleMaxSpawnAttempts})");
|
||||
Logging.Debug($"[ObstacleSpawner] Position {spawnPosition} invalid (attempt {attempts + 1}/{_settings.ObstacleMaxSpawnAttempts})");
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundValidPosition)
|
||||
{
|
||||
Debug.LogWarning($"[ObstacleSpawner] SPAWN MISSED: Could not find valid spawn position after {_settings.ObstacleMaxSpawnAttempts} attempts at {Time.time:F2}");
|
||||
Logging.Warning($"[ObstacleSpawner] SPAWN MISSED: Could not find valid spawn position after {_settings.ObstacleMaxSpawnAttempts} attempts at {Time.time:F2}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +444,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private void SpawnObstacleAt(Vector3 position)
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] SpawnObstacleAt called for position {position}");
|
||||
Logging.Debug($"[ObstacleSpawner] SpawnObstacleAt called for position {position}");
|
||||
|
||||
// Select random prefab
|
||||
int prefabIndex = Random.Range(0, obstaclePrefabs.Count);
|
||||
@@ -460,7 +461,7 @@ namespace Minigames.DivingForPictures
|
||||
// Spawn using pool or instantiate directly
|
||||
if (_devSettings.ObstacleUseObjectPooling && _obstaclePool != null)
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] Requesting obstacle from pool (prefab index {prefabIndex})");
|
||||
Logging.Debug($"[ObstacleSpawner] Requesting obstacle from pool (prefab index {prefabIndex})");
|
||||
obstacle = _obstaclePool.GetObstacle(prefabIndex);
|
||||
if (obstacle == null)
|
||||
{
|
||||
@@ -473,12 +474,12 @@ namespace Minigames.DivingForPictures
|
||||
obstacle.transform.rotation = prefab.transform.rotation;
|
||||
obstacle.transform.SetParent(transform);
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Got obstacle {obstacle.name} from pool, active state: {obstacle.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstacleSpawner] Got obstacle {obstacle.name} from pool, active state: {obstacle.activeInHierarchy}");
|
||||
|
||||
// ENHANCED FORCE ACTIVATION - more robust approach
|
||||
if (!obstacle.activeInHierarchy)
|
||||
{
|
||||
Debug.LogWarning($"[ObstacleSpawner] Pool returned inactive object {obstacle.name}, force activating!");
|
||||
Logging.Warning($"[ObstacleSpawner] Pool returned inactive object {obstacle.name}, force activating!");
|
||||
|
||||
// Configure obstacle BEFORE activation
|
||||
ConfigureObstacle(obstacle, prefabIndex);
|
||||
@@ -500,7 +501,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] After force activation, {obstacle.name} active state: {obstacle.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstacleSpawner] After force activation, {obstacle.name} active state: {obstacle.activeInHierarchy}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -510,7 +511,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] Instantiating new obstacle (pooling disabled)");
|
||||
Logging.Debug($"[ObstacleSpawner] Instantiating new obstacle (pooling disabled)");
|
||||
obstacle = Instantiate(prefab, position, prefab.transform.rotation, transform);
|
||||
|
||||
// Configure the newly instantiated obstacle
|
||||
@@ -521,16 +522,16 @@ namespace Minigames.DivingForPictures
|
||||
_obstacleCounter++;
|
||||
string oldName = obstacle.name;
|
||||
obstacle.name = $"Obstacle{_obstacleCounter:D3}";
|
||||
Debug.Log($"[ObstacleSpawner] Renamed obstacle from '{oldName}' to '{obstacle.name}', active state: {obstacle.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstacleSpawner] Renamed obstacle from '{oldName}' to '{obstacle.name}', active state: {obstacle.activeInHierarchy}");
|
||||
|
||||
// Track active obstacles
|
||||
_activeObstacles.Add(obstacle);
|
||||
|
||||
// Invoke events
|
||||
onObstacleSpawned?.Invoke(obstacle);
|
||||
Debug.Log($"[ObstacleSpawner] After events, obstacle {obstacle.name} active state: {obstacle.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstacleSpawner] After events, obstacle {obstacle.name} active state: {obstacle.activeInHierarchy}");
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Successfully spawned obstacle {obstacle.name} at {position}. Active count: {_activeObstacles.Count}, Final active state: {obstacle.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstacleSpawner] Successfully spawned obstacle {obstacle.name} at {position}. Active count: {_activeObstacles.Count}, Final active state: {obstacle.activeInHierarchy}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -567,7 +568,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
if (obstacle == null) return;
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] ReturnObstacleToPool called for {obstacle.name}, active state: {obstacle.activeInHierarchy}");
|
||||
Logging.Debug($"[ObstacleSpawner] ReturnObstacleToPool called for {obstacle.name}, active state: {obstacle.activeInHierarchy}");
|
||||
|
||||
// Remove from active list
|
||||
_activeObstacles.Remove(obstacle);
|
||||
@@ -578,12 +579,12 @@ namespace Minigames.DivingForPictures
|
||||
// Return to pool or destroy
|
||||
if (_devSettings.ObstacleUseObjectPooling && _obstaclePool != null)
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] Returning {obstacle.name} to pool");
|
||||
Logging.Debug($"[ObstacleSpawner] Returning {obstacle.name} to pool");
|
||||
_obstaclePool.ReturnObstacle(obstacle, prefabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[ObstacleSpawner] Destroying {obstacle.name} (pooling disabled)");
|
||||
Logging.Debug($"[ObstacleSpawner] Destroying {obstacle.name} (pooling disabled)");
|
||||
Destroy(obstacle);
|
||||
}
|
||||
}
|
||||
@@ -595,7 +596,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
// This method can no longer directly modify the settings
|
||||
// Consider implementing a runtime settings override system if needed
|
||||
Debug.LogWarning("[ObstacleSpawner] SetSpawnInterval no longer modifies settings directly. Settings are now centralized.");
|
||||
Logging.Warning("[ObstacleSpawner] SetSpawnInterval no longer modifies settings directly. Settings are now centralized.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -605,7 +606,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
// This method can no longer directly modify the settings
|
||||
// Consider implementing a runtime settings override system if needed
|
||||
Debug.LogWarning("[ObstacleSpawner] SetSpeedRange no longer modifies settings directly. Settings are now centralized.");
|
||||
Logging.Warning("[ObstacleSpawner] SetSpeedRange no longer modifies settings directly. Settings are now centralized.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -636,7 +637,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Velocity factor updated to {_velocityFactor:F2}, propagated to {_activeObstacles.Count} active obstacles");
|
||||
Logging.Debug($"[ObstacleSpawner] Velocity factor updated to {_velocityFactor:F2}, propagated to {_activeObstacles.Count} active obstacles");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -662,7 +663,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Started surfacing mode for {_activeObstacles.Count} active obstacles");
|
||||
Logging.Debug($"[ObstacleSpawner] Started surfacing mode for {_activeObstacles.Count} active obstacles");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -675,7 +676,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private IEnumerator SpawnObstacleRoutine()
|
||||
{
|
||||
Debug.Log("[ObstacleSpawner] Started spawning coroutine");
|
||||
Logging.Debug("[ObstacleSpawner] Started spawning coroutine");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused && !_isSurfacing)
|
||||
{
|
||||
@@ -694,7 +695,7 @@ namespace Minigames.DivingForPictures
|
||||
// Clear coroutine reference when stopped
|
||||
_spawnCoroutine = null;
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Spawning coroutine ended");
|
||||
Logging.Debug("[ObstacleSpawner] Spawning coroutine ended");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -704,7 +705,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private IEnumerator MoveObstaclesRoutine()
|
||||
{
|
||||
Debug.Log("[ObstacleSpawner] Started obstacle monitoring coroutine");
|
||||
Logging.Debug("[ObstacleSpawner] Started obstacle monitoring coroutine");
|
||||
|
||||
// This coroutine now just monitors obstacles, not moves them
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
@@ -718,7 +719,7 @@ namespace Minigames.DivingForPictures
|
||||
// Clear coroutine reference when stopped
|
||||
_moveCoroutine = null;
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Obstacle monitoring coroutine ended");
|
||||
Logging.Debug("[ObstacleSpawner] Obstacle monitoring coroutine ended");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -727,7 +728,7 @@ namespace Minigames.DivingForPictures
|
||||
private IEnumerator DespawnObstaclesRoutine()
|
||||
{
|
||||
const float checkInterval = 0.5f; // Check every half second
|
||||
Debug.Log("[ObstacleSpawner] Started despawn coroutine with interval: " + checkInterval);
|
||||
Logging.Debug("[ObstacleSpawner] Started despawn coroutine with interval: " + checkInterval);
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
@@ -808,7 +809,7 @@ namespace Minigames.DivingForPictures
|
||||
// Clear coroutine reference when stopped
|
||||
_despawnCoroutine = null;
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Despawn coroutine ended");
|
||||
Logging.Debug("[ObstacleSpawner] Despawn coroutine ended");
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using AppleHills.Core.Settings;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures.PictureCamera
|
||||
{
|
||||
@@ -206,7 +207,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
float canvasWidth = canvasRect.rect.width;
|
||||
targetViewfinderSize = canvasWidth * 0.25f;
|
||||
|
||||
Debug.LogWarning("[CameraViewfinderManager] No SpriteRenderer found on target, using default size");
|
||||
Logging.Warning("[CameraViewfinderManager] No SpriteRenderer found on target, using default size");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -290,7 +291,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, targetScreenPosition, uiCamera,
|
||||
out targetAnchoredPosition);
|
||||
|
||||
Debug.Log(
|
||||
Logging.Debug(
|
||||
$"[CameraViewfinderManager] Target size (canvas): {targetViewfinderSize}, target anchored: {targetAnchoredPosition}");
|
||||
}
|
||||
|
||||
@@ -331,7 +332,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
bool[] thresholdTriggered = new bool[settings.ViewfinderProgressThresholds.Length];
|
||||
|
||||
// Debug the actual values
|
||||
Debug.Log($"[CameraViewfinderManager] Animation starting: startSize={startSize}, endSize={endSize}, " +
|
||||
Logging.Debug($"[CameraViewfinderManager] Animation starting: startSize={startSize}, endSize={endSize}, " +
|
||||
$"current sizeDelta={viewfinderRectTransform.sizeDelta}");
|
||||
|
||||
// Verify the initial size is set correctly
|
||||
@@ -358,7 +359,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
// Additional check to ensure size is actually shrinking
|
||||
if (startSize > endSize && currentSize > startSize)
|
||||
{
|
||||
Debug.LogWarning($"[CameraViewfinderManager] Animation curve producing wrong direction! " +
|
||||
Logging.Warning($"[CameraViewfinderManager] Animation curve producing wrong direction! " +
|
||||
$"progress={animationProgress:F2}, curveValue={curveValue:F2}");
|
||||
// Force correct behavior
|
||||
curveValue = animationProgress; // Override with linear interpolation
|
||||
@@ -376,7 +377,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
// Log the animation state occasionally for debugging
|
||||
if (animationProgress % 0.25f <= 0.01f || animationProgress >= 0.99f)
|
||||
{
|
||||
Debug.Log($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " +
|
||||
Logging.Debug($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " +
|
||||
$"curveValue={curveValue:F2}, currentSize={currentSize:F2}, currentPos={newPos}");
|
||||
}
|
||||
|
||||
@@ -401,7 +402,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
OnAnimationCompleted?.Invoke();
|
||||
|
||||
// Log final state to confirm we reached the target size
|
||||
Debug.Log(
|
||||
Logging.Debug(
|
||||
$"[CameraViewfinderManager] Animation completed: final size={viewfinderRectTransform.sizeDelta}");
|
||||
|
||||
yield return new WaitForSecondsRealtime(0.5f);
|
||||
@@ -471,7 +472,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
viewfinderInstance = null;
|
||||
viewfinderComponent = null;
|
||||
viewfinderRectTransform = null;
|
||||
Debug.Log("[CameraViewfinderManager] Hid viewfinder");
|
||||
Logging.Debug("[CameraViewfinderManager] Hid viewfinder");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,7 +533,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
viewfinderRectTransform.sizeDelta = new Vector2(canvasWidth, canvasWidth);
|
||||
viewfinderRectTransform.anchoredPosition = Vector2.zero;
|
||||
|
||||
Debug.Log($"[CameraViewfinderManager] Showed full-screen viewfinder with size {canvasWidth}");
|
||||
Logging.Debug($"[CameraViewfinderManager] Showed full-screen viewfinder with size {canvasWidth}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -651,7 +652,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
bool[] thresholdTriggered = new bool[settings.ViewfinderProgressThresholds.Length];
|
||||
|
||||
// Debug the actual values
|
||||
Debug.Log($"[CameraViewfinderManager] Animation sequence starting: startSize={startSize}, endSize={endSize}");
|
||||
Logging.Debug($"[CameraViewfinderManager] Animation sequence starting: startSize={startSize}, endSize={endSize}");
|
||||
|
||||
// Verify the initial size is set correctly
|
||||
viewfinderRectTransform.sizeDelta = new Vector2(startSize, startSize);
|
||||
@@ -687,7 +688,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
// Log the animation state occasionally for debugging
|
||||
if (animationProgress % 0.25f <= 0.01f || animationProgress >= 0.99f)
|
||||
{
|
||||
Debug.Log($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " +
|
||||
Logging.Debug($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " +
|
||||
$"curveValue={curveValue:F2}, currentSize={currentSize:F2}, currentPos={newPos}, proximity={currentProximity:F2}");
|
||||
}
|
||||
|
||||
@@ -752,7 +753,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
// Log the animation state occasionally for debugging
|
||||
if (animationProgress % 0.25f <= 0.01f || animationProgress >= 0.99f)
|
||||
{
|
||||
Debug.Log($"[CameraViewfinderManager] Reverse animation progress: {animationProgress:F2}, " +
|
||||
Logging.Debug($"[CameraViewfinderManager] Reverse animation progress: {animationProgress:F2}, " +
|
||||
$"curveValue={curveValue:F2}, currentSize={currentSize:F2}, currentPos={newPos}, proximity={currentProximity:F2}");
|
||||
}
|
||||
|
||||
@@ -835,7 +836,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
{
|
||||
// Start the photo sequence when hold begins (same behavior as first tap in tap mode)
|
||||
OnViewfinderTapped?.Invoke();
|
||||
Debug.Log("[CameraViewfinderManager] Hold started - initiating photo sequence");
|
||||
Logging.Debug("[CameraViewfinderManager] Hold started - initiating photo sequence");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,7 +849,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
{
|
||||
// Complete the sequence when hold ends (same behavior as second tap in tap mode)
|
||||
OnViewfinderTappedDuringAnimation?.Invoke(currentProximity);
|
||||
Debug.Log("[CameraViewfinderManager] Hold ended - completing photo sequence with proximity: " + currentProximity);
|
||||
Logging.Debug("[CameraViewfinderManager] Hold ended - completing photo sequence with proximity: " + currentProximity);
|
||||
|
||||
// Complete the animation immediately
|
||||
if (animationCoroutine != null)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using Input;
|
||||
@@ -99,7 +100,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
{
|
||||
// Fire the tap event that PhotoSequenceController will listen to
|
||||
OnViewfinderTapped?.Invoke();
|
||||
Debug.Log($"[MDPI] Viewfinder OnTap: {position}");
|
||||
Logging.Debug($"[MDPI] Viewfinder OnTap: {position}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
{
|
||||
// Fire the hold start event
|
||||
OnViewfinderHoldStarted?.Invoke();
|
||||
Debug.Log($"[MDPI] Viewfinder OnHoldStart: {position}");
|
||||
Logging.Debug($"[MDPI] Viewfinder OnHoldStart: {position}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ namespace Minigames.DivingForPictures.PictureCamera
|
||||
{
|
||||
// Fire the hold end event
|
||||
OnViewfinderHoldEnded?.Invoke();
|
||||
Debug.Log($"[MDPI] Viewfinder OnHoldEnd: {position}");
|
||||
Logging.Debug($"[MDPI] Viewfinder OnHoldEnd: {position}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -32,7 +33,7 @@ namespace Minigames.DivingForPictures
|
||||
if (obstacle.gameObject.layer != _devSettings.ObstacleLayer)
|
||||
{
|
||||
// If not on the obstacle layer, don't process the collision
|
||||
Debug.Log($"[ObstacleCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.ObstacleLayer})");
|
||||
Logging.Debug($"[ObstacleCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.ObstacleLayer})");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace Minigames.DivingForPictures
|
||||
obstacleComponent.MarkDamageDealt();
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleCollision] Player hit by obstacle {obstacle.gameObject.name}");
|
||||
Logging.Debug($"[ObstacleCollision] Player hit by obstacle {obstacle.gameObject.name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -51,7 +52,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private void HandleImmunityStarted()
|
||||
{
|
||||
Debug.Log($"[ObstacleCollision] Damage immunity started for {_gameSettings.DamageImmunityDuration} seconds");
|
||||
Logging.Debug($"[ObstacleCollision] Damage immunity started for {_gameSettings.DamageImmunityDuration} seconds");
|
||||
|
||||
// Don't block input for obstacle damage - let player keep moving
|
||||
// The shared immunity system will handle the collision prevention
|
||||
@@ -62,7 +63,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private void HandleImmunityEnded()
|
||||
{
|
||||
Debug.Log($"[ObstacleCollision] Damage immunity ended");
|
||||
Logging.Debug($"[ObstacleCollision] Damage immunity ended");
|
||||
// No special handling needed - shared immunity system handles collider re-enabling
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using AppleHills.Core.Settings;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -40,7 +41,7 @@ namespace Minigames.DivingForPictures
|
||||
targetSpriteRenderer = GetComponentInChildren<SpriteRenderer>();
|
||||
if (targetSpriteRenderer != null)
|
||||
{
|
||||
Debug.Log($"[PlayerBlinkBehavior] Found SpriteRenderer on child object: {targetSpriteRenderer.gameObject.name}");
|
||||
Logging.Debug($"[PlayerBlinkBehavior] Found SpriteRenderer on child object: {targetSpriteRenderer.gameObject.name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections;
|
||||
using AppleHills.Core.Settings;
|
||||
using AppleHills.Utilities;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -228,7 +229,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
playerController.enabled = false;
|
||||
wasInputBlocked = true;
|
||||
Debug.Log($"[{GetType().Name}] Player input blocked during immunity");
|
||||
Logging.Debug($"[{GetType().Name}] Player input blocked during immunity");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +246,7 @@ namespace Minigames.DivingForPictures
|
||||
// Update the controller's target position to current position to prevent snapping
|
||||
UpdateControllerTarget();
|
||||
|
||||
Debug.Log($"[{GetType().Name}] Player input restored after immunity");
|
||||
Logging.Debug($"[{GetType().Name}] Player input restored after immunity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using AppleHills.Core.Settings;
|
||||
using Input;
|
||||
using AppleHillsCamera;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -59,11 +60,11 @@ namespace Minigames.DivingForPictures
|
||||
edgeAnchor = FindObjectOfType<EdgeAnchor>();
|
||||
if (edgeAnchor == null)
|
||||
{
|
||||
Debug.LogWarning("[PlayerController] No EdgeAnchor found in scene. Origin Y position won't update with camera changes.");
|
||||
Logging.Warning("[PlayerController] No EdgeAnchor found in scene. Origin Y position won't update with camera changes.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[PlayerController] Auto-connected to EdgeAnchor on {edgeAnchor.gameObject.name}");
|
||||
Logging.Debug($"[PlayerController] Auto-connected to EdgeAnchor on {edgeAnchor.gameObject.name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +102,7 @@ namespace Minigames.DivingForPictures
|
||||
InputManager.Instance?.SetDefaultConsumer(this);
|
||||
|
||||
_isInitialized = true;
|
||||
Debug.Log("[PlayerController] Initialized");
|
||||
Logging.Debug("[PlayerController] Initialized");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -120,7 +121,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void OnTap(Vector2 worldPosition)
|
||||
{
|
||||
// Debug.Log($"[EndlessDescenderController] OnTap at {worldPosition}");
|
||||
// Logging.Debug($"[EndlessDescenderController] OnTap at {worldPosition}");
|
||||
float targetX = Mathf.Clamp(worldPosition.x, _settings.ClampXMin, _settings.ClampXMax);
|
||||
|
||||
// Calculate tap direction (+1 for right, -1 for left)
|
||||
@@ -141,7 +142,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void OnHoldStart(Vector2 worldPosition)
|
||||
{
|
||||
// Debug.Log($"[EndlessDescenderController] OnHoldStart at {worldPosition}");
|
||||
// Logging.Debug($"[EndlessDescenderController] OnHoldStart at {worldPosition}");
|
||||
_targetFingerX = Mathf.Clamp(worldPosition.x, _settings.ClampXMin, _settings.ClampXMax);
|
||||
_isTouchActive = true;
|
||||
}
|
||||
@@ -151,7 +152,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void OnHoldMove(Vector2 worldPosition)
|
||||
{
|
||||
// Debug.Log($"[EndlessDescenderController] OnHoldMove at {worldPosition}");
|
||||
// Logging.Debug($"[EndlessDescenderController] OnHoldMove at {worldPosition}");
|
||||
_targetFingerX = Mathf.Clamp(worldPosition.x, _settings.ClampXMin, _settings.ClampXMax);
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public void OnHoldEnd(Vector2 worldPosition)
|
||||
{
|
||||
// Debug.Log($"[EndlessDescenderController] OnHoldEnd at {worldPosition}");
|
||||
// Logging.Debug($"[EndlessDescenderController] OnHoldEnd at {worldPosition}");
|
||||
_isTouchActive = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GogoGaga.OptimizedRopesAndCables;
|
||||
using Core;
|
||||
using GogoGaga.OptimizedRopesAndCables;
|
||||
using UnityEngine;
|
||||
|
||||
public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
@@ -46,7 +47,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
if (targetTransform != null)
|
||||
{
|
||||
target = targetTransform;
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Using assigned target transform: {target.name}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Using assigned target transform: {target.name}");
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(targetTag))
|
||||
{
|
||||
@@ -54,7 +55,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
if (found)
|
||||
{
|
||||
target = found.transform;
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Found target by tag '{targetTag}': {target.name}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Found target by tag '{targetTag}': {target.name}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,14 +72,14 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
if (canFall)
|
||||
{
|
||||
physicsVelocity = new Vector2(0, -initialFallImpulse);
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Initialized with target: {target.name}, initial Y velocity: {physicsVelocity.y}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Initialized with target: {target.name}, initial Y velocity: {physicsVelocity.y}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = Vector2.zero;
|
||||
lastTargetPosition = transform.position;
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] No target found");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] No target found");
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
@@ -124,7 +125,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
// Debug log to track vertical hanging behavior
|
||||
if (debugLog && Time.frameCount % 120 == 0)
|
||||
{
|
||||
Debug.Log($"[RopeEndPhysicsFollower] Vertical hanging: target X={target.position.x}, my X={transform.position.x}, offset={xOffset}");
|
||||
Logging.Debug($"[RopeEndPhysicsFollower] Vertical hanging: target X={target.position.x}, my X={transform.position.x}, offset={xOffset}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
|
||||
if (debugLog && Time.frameCount % 60 == 0)
|
||||
{
|
||||
Debug.Log($"[RopeEndPhysicsFollower] Exceeding max distance: {exceededDistance}, applying constraint");
|
||||
Logging.Debug($"[RopeEndPhysicsFollower] Exceeding max distance: {exceededDistance}, applying constraint");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +153,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
// Log physics state periodically for debugging
|
||||
if (debugLog && Time.frameCount % 60 == 0)
|
||||
{
|
||||
Debug.Log($"[RopeEndPhysicsFollower] Y position: {transform.position.y}, Y velocity: {physicsVelocity.y}, Distance: {currentDistance}/{maxDistance}");
|
||||
Logging.Debug($"[RopeEndPhysicsFollower] Y position: {transform.position.y}, Y velocity: {physicsVelocity.y}, Distance: {currentDistance}/{maxDistance}");
|
||||
}
|
||||
|
||||
// Apply physics velocity to position
|
||||
@@ -227,13 +228,13 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
if (attachedRope != null)
|
||||
{
|
||||
maxDistance = attachedRope.ropeLength;
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Found attached rope with length: {maxDistance}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Found attached rope with length: {maxDistance}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default fallback value if no rope is found
|
||||
maxDistance = 2f;
|
||||
if (debugLog) Debug.Log("[RopeEndPhysicsFollower] No attached rope found, using default max distance");
|
||||
if (debugLog) Logging.Debug("[RopeEndPhysicsFollower] No attached rope found, using default max distance");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +265,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
if (canFall)
|
||||
{
|
||||
physicsVelocity = new Vector2(physicsVelocity.x, -initialFallImpulse);
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Reset Y velocity to {physicsVelocity.y} after target change to {target.name}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Reset Y velocity to {physicsVelocity.y} after target change to {target.name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,7 +294,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
pos.y = target.position.y;
|
||||
transform.position = pos;
|
||||
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Physics forcibly reset, new Y velocity: {physicsVelocity.y}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Physics forcibly reset, new Y velocity: {physicsVelocity.y}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,6 +302,6 @@ public class RopeEndPhysicsFollower : MonoBehaviour
|
||||
public void SetMaxDistance(float distance)
|
||||
{
|
||||
maxDistance = distance;
|
||||
if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Max distance manually set to: {maxDistance}");
|
||||
if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Max distance manually set to: {maxDistance}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using AppleHills.Core.Settings;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace Minigames.DivingForPictures
|
||||
if (obstacle.gameObject.layer != _devSettings.TrenchTileLayer)
|
||||
{
|
||||
// If not on the trench tile layer, don't process the collision
|
||||
Debug.Log($"[TileBumpCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.TrenchTileLayer})");
|
||||
Logging.Debug($"[TileBumpCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.TrenchTileLayer})");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace Minigames.DivingForPictures
|
||||
break;
|
||||
}
|
||||
|
||||
Debug.Log($"[TileBumpCollision] Collision handled with {_devSettings.BumpMode} mode");
|
||||
Logging.Debug($"[TileBumpCollision] Collision handled with {_devSettings.BumpMode} mode");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -64,7 +65,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
StartBump(currentX, targetX, bumpDuration);
|
||||
|
||||
Debug.Log($"[TileBumpCollision] Starting impulse bump from X={currentX} to X={targetX} (force={_gameSettings.BumpForce})");
|
||||
Logging.Debug($"[TileBumpCollision] Starting impulse bump from X={currentX} to X={targetX} (force={_gameSettings.BumpForce})");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -82,7 +83,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
StartBump(currentX, targetX, bumpDuration);
|
||||
|
||||
Debug.Log($"[TileBumpCollision] Starting smooth move to center from X={currentX} (speed={_gameSettings.SmoothMoveSpeed}, duration={bumpDuration:F2}s)");
|
||||
Logging.Debug($"[TileBumpCollision] Starting smooth move to center from X={currentX} (speed={_gameSettings.SmoothMoveSpeed}, duration={bumpDuration:F2}s)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -144,7 +145,7 @@ namespace Minigames.DivingForPictures
|
||||
_isBumping = false;
|
||||
_bumpCoroutine = null;
|
||||
|
||||
Debug.Log("[TileBumpCollision] Bump movement completed");
|
||||
Logging.Debug("[TileBumpCollision] Bump movement completed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
using Pooling;
|
||||
|
||||
@@ -26,7 +27,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"Attempted to return a GameObject without a Tile component: {tile.name}");
|
||||
Logging.Warning($"Attempted to return a GameObject without a Tile component: {tile.name}");
|
||||
Destroy(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using Pooling;
|
||||
using AppleHills.Core.Settings;
|
||||
using Utils;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using Core;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -158,7 +159,7 @@ namespace Minigames.DivingForPictures
|
||||
// Check if the prefab has a Tile component
|
||||
if (tilePrefabs[i].GetComponent<Tile>() == null)
|
||||
{
|
||||
Debug.LogWarning($"Prefab {tilePrefabs[i].name} does not have a Tile component. Adding one automatically.");
|
||||
Logging.Warning($"Prefab {tilePrefabs[i].name} does not have a Tile component. Adding one automatically.");
|
||||
// Add the Tile component if it doesn't exist
|
||||
tilePrefabs[i].AddComponent<Tile>();
|
||||
}
|
||||
@@ -220,7 +221,7 @@ namespace Minigames.DivingForPictures
|
||||
_speedRampingCoroutine = null;
|
||||
}
|
||||
|
||||
Debug.Log("[TrenchTileSpawner] Paused");
|
||||
Logging.Debug("[TrenchTileSpawner] Paused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -238,7 +239,7 @@ namespace Minigames.DivingForPictures
|
||||
StartTileSpawningCoroutine();
|
||||
StartSpeedRampingCoroutine();
|
||||
|
||||
Debug.Log("[TrenchTileSpawner] Resumed");
|
||||
Logging.Debug("[TrenchTileSpawner] Resumed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -264,7 +265,7 @@ namespace Minigames.DivingForPictures
|
||||
StartTileSpawningCoroutine();
|
||||
StartSpeedRampingCoroutine();
|
||||
|
||||
Debug.Log("[TrenchTileSpawner] Initialized with normalized speed");
|
||||
Logging.Debug("[TrenchTileSpawner] Initialized with normalized speed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -327,7 +328,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
// Fallback in case no renderer is found
|
||||
_tileHeights[prefab] = DefaultTileHeight;
|
||||
Debug.LogWarning($"No renderer found in prefab {prefab.name}. Using default height of {DefaultTileHeight}.");
|
||||
Logging.Warning($"No renderer found in prefab {prefab.name}. Using default height of {DefaultTileHeight}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,7 +450,7 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
// Calculate normalization factor based on screen height
|
||||
_screenNormalizationFactor = Screen.height / referenceHeight;
|
||||
Debug.Log($"[TrenchTileSpawner] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})");
|
||||
Logging.Debug($"[TrenchTileSpawner] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -466,7 +467,7 @@ namespace Minigames.DivingForPictures
|
||||
// Recalculate velocity immediately
|
||||
CalculateVelocity();
|
||||
|
||||
Debug.Log($"[TrenchTileSpawner] Velocity factor updated to {_velocityFactor:F2}, moveSpeed: {_baseMoveSpeed:F2}");
|
||||
Logging.Debug($"[TrenchTileSpawner] Velocity factor updated to {_velocityFactor:F2}, moveSpeed: {_baseMoveSpeed:F2}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -482,7 +483,7 @@ namespace Minigames.DivingForPictures
|
||||
// Reverse the active tiles array to maintain consistent indexing logic
|
||||
_activeTiles.Reverse();
|
||||
|
||||
Debug.Log("[TrenchTileSpawner] Started surfacing - reversed array order");
|
||||
Logging.Debug("[TrenchTileSpawner] Started surfacing - reversed array order");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -509,7 +510,7 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
private IEnumerator MoveActiveTilesRoutine()
|
||||
{
|
||||
Debug.Log($"[TrenchTileSpawner] Started movement coroutine with normalized speed: {_baseMoveSpeed:F3}");
|
||||
Logging.Debug($"[TrenchTileSpawner] Started movement coroutine with normalized speed: {_baseMoveSpeed:F3}");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
@@ -550,7 +551,7 @@ namespace Minigames.DivingForPictures
|
||||
private IEnumerator TileDestructionRoutine()
|
||||
{
|
||||
const float checkInterval = 0.5f; // Check every half second
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s");
|
||||
Logging.Debug($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
@@ -618,7 +619,7 @@ namespace Minigames.DivingForPictures
|
||||
private IEnumerator TileSpawningRoutine()
|
||||
{
|
||||
const float checkInterval = 0.2f; // Check every fifth of a second
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s");
|
||||
Logging.Debug($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused && !_stopSpawning)
|
||||
{
|
||||
@@ -711,7 +712,7 @@ namespace Minigames.DivingForPictures
|
||||
private IEnumerator SpeedRampingRoutine()
|
||||
{
|
||||
const float checkInterval = 1.0f; // Check once per second
|
||||
Debug.Log($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s");
|
||||
Logging.Debug($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
@@ -887,7 +888,7 @@ namespace Minigames.DivingForPictures
|
||||
_activeTiles.Add(tile);
|
||||
_tileLastUsed[prefabIndex] = _spawnCounter++;
|
||||
_currentDepth++;
|
||||
Debug.Log($"[TrenchTileSpawner] Current Depth: {_currentDepth}");
|
||||
Logging.Debug($"[TrenchTileSpawner] Current Depth: {_currentDepth}");
|
||||
onTileSpawned?.Invoke(tile);
|
||||
|
||||
// --- FLOATING AREA STATE MANAGEMENT ---
|
||||
@@ -949,7 +950,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
_activeTiles.Add(tile);
|
||||
_currentDepth++;
|
||||
Debug.Log($"[TrenchTileSpawner] Current Depth: {_currentDepth}");
|
||||
Logging.Debug($"[TrenchTileSpawner] Current Depth: {_currentDepth}");
|
||||
onTileSpawned?.Invoke(tile);
|
||||
// Optionally update floating area state if needed
|
||||
Tile spawnedTile = tile.GetComponent<Tile>();
|
||||
@@ -1035,7 +1036,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
if (tile == null)
|
||||
{
|
||||
Debug.LogWarning("Attempted to get height of null tile!");
|
||||
Logging.Warning("Attempted to get height of null tile!");
|
||||
return DefaultTileHeight;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1172,7 @@ namespace Minigames.DivingForPictures
|
||||
private IEnumerator TileDestructionCoroutine()
|
||||
{
|
||||
const float checkInterval = 0.5f; // Check every half second as requested
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s");
|
||||
Logging.Debug($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
{
|
||||
@@ -1248,7 +1249,7 @@ namespace Minigames.DivingForPictures
|
||||
private IEnumerator TileSpawningCoroutine()
|
||||
{
|
||||
const float checkInterval = 0.2f; // Check every half second as requested
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s");
|
||||
Logging.Debug($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user