优化移动平台与玩家的交互逻辑,采用速度双缓冲方案以提升运动平滑度和代码清晰度
This commit is contained in:
@@ -68,7 +68,13 @@ namespace BaseGames.Player.States
|
||||
// OnStateUpdate 中仍保留同样的检测作为跨帧补充,两者不会发生双重转换:
|
||||
// 本帧若在 FixedUpdate 中转换到 FallState,Update 调用的将是 FallState.OnStateUpdate()。
|
||||
if (!Move.IsGrounded)
|
||||
{
|
||||
_owner.TransitionTo(_owner.GetState<FallState>());
|
||||
return;
|
||||
}
|
||||
// 无水平输入时仍需每帧调用 Move(0),使 _platformVelocity.x 被叠加进 velocity.x,
|
||||
// 确保站在移动平台上的玩家随平台同步移动,不产生相对位移。
|
||||
Move.Move(0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user