添加翻转视觉朝向的方法以支持蹬墙跳时的即时转向,并在切换到 WallSlideState 时确保正确刷新抓墙高度

This commit is contained in:
2026-05-21 20:57:03 +08:00
parent cb68ad6a2f
commit d38505fd31
2 changed files with 22 additions and 1 deletions

View File

@@ -40,7 +40,11 @@ namespace BaseGames.Player.States
{
// 施加对应类型的速度
if (_isAwayJump)
{
Move?.WallJumpAway(_wallDir);
// 背墙跳:立即转向远离墙壁的方向(不清零速度)
Move?.FlipFacing(-_wallDir);
}
else
Move?.WallJumpToward(_wallDir);
@@ -76,7 +80,13 @@ namespace BaseGames.Player.States
var wd = Owner.WallDetector;
if (wd != null && wd.IsTouchingWall && !Move.IsGrounded)
{
Owner.TransitionTo(Owner.GetState<WallSlideState>());
// 传入真实墙壁方向,确保切换到对面墙时 WallSlideState 能正确刷新抓墙高度
var wss = Owner.GetState<WallSlideState>();
if (wss != null)
{
wss.PrepareEnter(wd.WallDirection);
Owner.TransitionTo(wss);
}
return;
}
}