using Platformer.Core;
using Platformer.Mechanics;
using static Platformer.Core.Simulation;
namespace Platformer.Gameplay
{
///
/// Fired when the player health reaches 0. This usually would result in a
/// PlayerDeath event.
/// BT12-Dev 2026-05-09 — sender 가드 추가. Enemy.Health hp=0 시 무차별 PlayerDeath 발화 차단.
/// 근본: Health.Decrement·Die 4곳에서 Schedule(sender 미구분) → Execute에서 PlayerDeath 직결 → 적 처치 시 Player 즉사 버그.
///
///
public class HealthIsZero : Simulation.Event
{
public Health health;
public override void Execute()
{
if (health == null) return;
// PlayerController 보유 Health만 PlayerDeath 발화 (Enemy 등 다른 Health 영역 차단).
if (health.GetComponent() == null) return;
Schedule();
}
}
}