using Platformer.Core; using Platformer.Mechanics; using Platformer.Model; using UnityEngine; using static Platformer.Core.Simulation; namespace Platformer.Gameplay { /// /// Fired when a Player collides with an Enemy. /// BT5-Dev 2단계 개정: 기획 04 §3·§5 준수 — "위에서 밟기" 판정 폐기, i-frame 체크된 피격 로직으로 교체. /// 적 처치는 PlayerAttack 이벤트 + AttackHitbox 공격 판정 경로로 일원화. /// 적과 접촉 시 플레이어는 i-frame 내라면 피해 없음, 아니면 라이프 1 → 사망 체인 발동. /// /// public class PlayerEnemyCollision : Simulation.Event { public EnemyController enemy; public PlayerController player; PlatformerModel model = Simulation.GetModel(); public override void Execute() { if (player == null || player.health == null) return; // i-frame 내에는 피해 무효 (Health.Decrement가 내부에서 체크) // — 접촉 지속 동안 연속 히트되는 것을 방지 if (player.health.IsInvulnerable) return; // 적과 접촉 → 플레이어 피해 (Health.Decrement가 i-frame 활성화) player.health.Decrement(); // HP 0 도달 시 HealthIsZero 이벤트가 PlayerDeath 체인을 발동 (기존 경로) // 여기서 Schedule 직접 호출은 중복이므로 제거 — Health 이벤트 체인 신뢰 } } }