feat(enemy): ContactChaseAbility 改造为 RushAbility(冲锋)
- 起手前锁定玩家 X 与方向(committed),终点改为身体整体越过锁定点(Body.HasPassed) - 终止条件:越过锁定点/撞墙(只判墙)/最大冲刺时长(SO 新增 maxDashDuration)/净位移卡死 - 冲锋期间经 EnemyMoveInput.AllowLedgeCross 放开悬崖夹紧,可冲下崖不悬停边缘 - 类与文件重命名(GUID 保留),脚手架与向导同步更新
This commit is contained in:
@@ -404,12 +404,13 @@ namespace BaseGames.Enemies
|
||||
{
|
||||
PendingInput.MoveDir = 0f;
|
||||
PendingInput.MoveSpeed = 0f;
|
||||
PendingInput.AllowLedgeCross = false; // 随移动意图一并复位,避免越崖许可残留
|
||||
StopHorizontal();
|
||||
}
|
||||
else if (PendingInput.MoveDir != 0f)
|
||||
{
|
||||
if (PendingInput.MoveSpeed > 0f)
|
||||
MoveWithSpeed(PendingInput.MoveDir, PendingInput.MoveSpeed);
|
||||
MoveWithSpeed(PendingInput.MoveDir, PendingInput.MoveSpeed, PendingInput.AllowLedgeCross);
|
||||
else
|
||||
MoveHorizontal(PendingInput.MoveDir);
|
||||
}
|
||||
@@ -435,15 +436,19 @@ namespace BaseGames.Enemies
|
||||
_rb.velocity = vel;
|
||||
}
|
||||
|
||||
/// <summary>显式指定速度(BD 追击任务调用)。转身动画期间调用无效。</summary>
|
||||
public void MoveWithSpeed(float dir, float speed)
|
||||
/// <summary>
|
||||
/// 显式指定速度移动。转身动画期间调用无效。
|
||||
/// <paramref name="allowLedgeCross"/> = true 时跳过悬崖夹紧,允许冲出平台边缘后自由落体
|
||||
/// (committed 冲锋用;见 <see cref="EnemyMoveInput.AllowLedgeCross"/>)。
|
||||
/// </summary>
|
||||
public void MoveWithSpeed(float dir, float speed, bool allowLedgeCross = false)
|
||||
{
|
||||
if (_isTurning) return;
|
||||
if (dir != 0f) UpdateFacing(dir);
|
||||
// 地面怪追击/导航:前缘将越过地形边缘(悬崖)则不前进——碰撞体边缘停在地形边缘、不越界。
|
||||
// 只夹"悬崖"不夹"墙"(墙交给寻路绕行,免得贴墙路径被误夹停);跨沟的 nav-link 跳/落
|
||||
// 不经本方法(EnemyNavAgent 仅在 IsMovingOnSegment 时写 MoveSpeed),故不影响跳跃/下落过沟。
|
||||
if (dir != 0f && IsGrounded && WouldFallAhead(dir)) dir = 0f;
|
||||
if (dir != 0f && !allowLedgeCross && IsGrounded && WouldFallAhead(dir)) dir = 0f;
|
||||
var vel = _rb.velocity;
|
||||
vel.x = dir * speed;
|
||||
_rb.velocity = vel;
|
||||
|
||||
Reference in New Issue
Block a user