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