Strip debug logging from the game, fix screen weirdness

This commit is contained in:
Michal Pikulski
2025-10-14 15:53:58 +02:00
parent 18be597424
commit e8180b21bf
65 changed files with 768 additions and 411 deletions

View File

@@ -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
}
}

View File

@@ -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}");
}
}
}

View File

@@ -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");
}
}

View File

@@ -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;
}

View File

@@ -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}");
}
}

View File

@@ -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");
}
}
}