fix(combat): 地刺死亡判定改从 HurtBox 向上查找——死亡不再误传回检查点

此前经 other.transform.root 查 IDamageable,玩家被临时挂到其他
父物体(如移动平台)下时 root 非玩家根节点而漏判死亡,导致致死
触碰仍 Raise EVT_CheckpointRespawn 与死亡流程撞车。改为
other.GetComponentInParent 从 HurtBox 自身向上查找,任何层级
结构下死亡均只走死亡流程,存活才回溯检查点。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 11:20:10 +08:00
parent 01787e9c34
commit bedb0f8ff4

View File

@@ -89,9 +89,12 @@ namespace BaseGames.Combat
hurtBox.ReceiveDamage(info); hurtBox.ReceiveDamage(info);
// 检测伤害后玩家存活状态: // 检测伤害后玩家存活状态:
// 若已死亡PlayerController.TakeDamage 已在同帧内 Raise EVT_PlayerDied // 若已死亡PlayerController.TakeDamage 已在同帧内 Raise EVT_PlayerDied
// 走完整死亡流程,本组件不得再 Raise 检查点回溯;
// 若存活,需由本组件 Raise 使其回到检查点。 // 若存活,需由本组件 Raise 使其回到检查点。
var damageable = other.transform.root.GetComponentInParent<IDamageable>(); // 从 HurtBox 自身向上查找(而非 transform.root玩家被临时挂到
// 其他父物体(如移动平台)下时 root 不是玩家根节点,会漏判死亡。
var damageable = other.GetComponentInParent<IDamageable>();
playerDiedFromDamage = damageable != null && !damageable.IsAlive; playerDiedFromDamage = damageable != null && !damageable.IsAlive;
} }
} }