diff --git a/Assets/_Game/Scripts/Combat/LethalTrap.cs b/Assets/_Game/Scripts/Combat/LethalTrap.cs index db0b668..2b5084b 100644 --- a/Assets/_Game/Scripts/Combat/LethalTrap.cs +++ b/Assets/_Game/Scripts/Combat/LethalTrap.cs @@ -47,6 +47,11 @@ namespace BaseGames.Combat [Tooltip("true = 顶部有 HurtBox 子节点可下劈弹跳(需手动添加 Pogo Surface 子节点)")] [SerializeField] private bool _canPogo = true; + /// + /// 单次接触闩锁:防止同一次触碰内重复结算(如淡出等待期间的物理回调)。 + /// 玩家 HurtBox 离开触发区(OnTriggerExit2D,含检查点传送移位)后重置, + /// 使陷阱对下一次触碰再次生效;死亡路径则经场景重载由 OnEnable 重置。 + /// private bool _triggered; private void Awake() @@ -102,6 +107,12 @@ namespace BaseGames.Combat } } + private void OnTriggerExit2D(Collider2D other) + { + if ((_playerLayers.value & (1 << other.gameObject.layer)) == 0) return; + _triggered = false; + } + #if UNITY_EDITOR [UnityEngine.ContextMenu("打印 Pogo 提示")] private void PrintPogoInfo()