修复内容:
PlayerMovement:新增 _facingLocked 字段 + LockFacing(bool) 方法;UpdateFacing() 锁定时直接返回 WallSlideState:OnStateEnter 调用 LockFacing(true) + FlipFacing(_wallDir);OnStateExit 调用 LockFacing(false) 解锁 WallJumpState:OnStateEnter 保险性再调一次 LockFacing(false);WallJumpAway/Toward 同步写入 _inputVelocityX,确保解锁后 UpdateFacing 朝向正确(背墙跳 = 离墙方向,对墙跳 = 朝墙方向)
This commit is contained in:
@@ -4,6 +4,7 @@ namespace BaseGames.World
|
||||
{
|
||||
/// <summary>
|
||||
/// 幻影可交互机关。继承 DirectionalInteractable,额外响应 PhantomBody 层(太虚斩形态)。
|
||||
/// 通过覆写 IsValidTriggerBody 扩展触发主体,_triggerCondition 条件检查由父类统一处理。
|
||||
/// </summary>
|
||||
public class PhantomInteractable : DirectionalInteractable
|
||||
{
|
||||
@@ -11,13 +12,7 @@ namespace BaseGames.World
|
||||
|
||||
private void Awake() => _phantomBodyLayer = LayerMask.NameToLayer("PhantomBody");
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
bool isPlayer = other.CompareTag("Player");
|
||||
bool isPhantom = other.gameObject.layer == _phantomBodyLayer;
|
||||
|
||||
if (!isPlayer && !isPhantom) return;
|
||||
TryActivate();
|
||||
}
|
||||
protected override bool IsValidTriggerBody(Collider2D col)
|
||||
=> col.CompareTag("Player") || col.gameObject.layer == _phantomBodyLayer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user