From bedb0f8ff406ff320b017fd721e156d792cf0663 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Fri, 12 Jun 2026 11:20:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(combat):=20=E5=9C=B0=E5=88=BA=E6=AD=BB?= =?UTF-8?q?=E4=BA=A1=E5=88=A4=E5=AE=9A=E6=94=B9=E4=BB=8E=20HurtBox=20?= =?UTF-8?q?=E5=90=91=E4=B8=8A=E6=9F=A5=E6=89=BE=E2=80=94=E2=80=94=E6=AD=BB?= =?UTF-8?q?=E4=BA=A1=E4=B8=8D=E5=86=8D=E8=AF=AF=E4=BC=A0=E5=9B=9E=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此前经 other.transform.root 查 IDamageable,玩家被临时挂到其他 父物体(如移动平台)下时 root 非玩家根节点而漏判死亡,导致致死 触碰仍 Raise EVT_CheckpointRespawn 与死亡流程撞车。改为 other.GetComponentInParent 从 HurtBox 自身向上查找,任何层级 结构下死亡均只走死亡流程,存活才回溯检查点。 Co-Authored-By: Claude Fable 5 --- Assets/_Game/Scripts/Combat/LethalTrap.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/_Game/Scripts/Combat/LethalTrap.cs b/Assets/_Game/Scripts/Combat/LethalTrap.cs index 2b5084b..4562b84 100644 --- a/Assets/_Game/Scripts/Combat/LethalTrap.cs +++ b/Assets/_Game/Scripts/Combat/LethalTrap.cs @@ -89,9 +89,12 @@ namespace BaseGames.Combat hurtBox.ReceiveDamage(info); // 检测伤害后玩家存活状态: - // 若已死亡,PlayerController.TakeDamage 已在同帧内 Raise EVT_PlayerDied; + // 若已死亡,PlayerController.TakeDamage 已在同帧内 Raise EVT_PlayerDied, + // 走完整死亡流程,本组件不得再 Raise 检查点回溯; // 若存活,需由本组件 Raise 使其回到检查点。 - var damageable = other.transform.root.GetComponentInParent(); + // 从 HurtBox 自身向上查找(而非 transform.root):玩家被临时挂到 + // 其他父物体(如移动平台)下时 root 不是玩家根节点,会漏判死亡。 + var damageable = other.GetComponentInParent(); playerDiedFromDamage = damageable != null && !damageable.IsAlive; } }