优化移动平台与玩家的交互逻辑,采用速度双缓冲方案以提升运动平滑度和代码清晰度

This commit is contained in:
2026-05-21 19:27:36 +08:00
parent 39483c4460
commit 8ccfa22a0e
6 changed files with 69 additions and 35 deletions

View File

@@ -68,7 +68,13 @@ namespace BaseGames.Player.States
// OnStateUpdate 中仍保留同样的检测作为跨帧补充,两者不会发生双重转换:
// 本帧若在 FixedUpdate 中转换到 FallStateUpdate 调用的将是 FallState.OnStateUpdate()。
if (!Move.IsGrounded)
{
_owner.TransitionTo(_owner.GetState<FallState>());
return;
}
// 无水平输入时仍需每帧调用 Move(0),使 _platformVelocity.x 被叠加进 velocity.x
// 确保站在移动平台上的玩家随平台同步移动,不产生相对位移。
Move.Move(0f);
}
}
}