using UnityEngine;
namespace Minigames.DivingForPictures
{
///
/// Collision behavior that handles damage from mobile obstacles.
/// Uses trigger-based collision detection with shared immunity state.
///
public class ObstacleCollision : PlayerCollisionBehavior
{
protected override void HandleCollisionResponse(Collider2D obstacle)
{
// Mark the obstacle as having dealt damage to prevent multiple hits
FloatingObstacle obstacleComponent = obstacle.GetComponent();
if (obstacleComponent != null)
{
obstacleComponent.MarkDamageDealt();
}
Debug.Log($"[ObstacleCollision] Player hit by obstacle {obstacle.gameObject.name}");
}
///
/// Override to prevent input blocking during damage immunity
/// Since obstacles pass through the player, we don't want to block input
///
protected override void OnImmunityStart()
{
Debug.Log($"[ObstacleCollision] Damage immunity started for {damageImmunityDuration} seconds");
// Don't block input for obstacle damage - let player keep moving
// The shared immunity system will handle the collision prevention
}
///
/// Override to handle immunity end
///
protected override void OnImmunityEnd()
{
Debug.Log($"[ObstacleCollision] Damage immunity ended");
// No special handling needed - shared immunity system handles collider re-enabling
}
}
}