feat(enemy): 目标点吸附统一处理导航宽度,Waypoint 不再卡崖边

将"角色导航宽度"收口到导航执行层单一入口,意图层(Locomotion/AI)只递原始目标、不再感知身体尺寸:

- NavAgent 新增 TryGetStandablePointNear:把世界点映射到最近可行走段并按 endMargin 内缩两端(与 SetRandomDestinationOnCurrentSegment 同源)
- EnemyNavAgent 新增 ResolveStandablePoint,以 EnemyMovement.EdgeSafeMargin(半宽+落崖余量)为唯一宽度真源;加 _goalMapSearchRadius
- IPathAgent 暴露 ResolveStandablePoint;FlyingDirectNavigator 原样返回(飞行无崖沿约束),NullPathAgent 空实现
- EnemyLocomotion Waypoint 分支改用吸附后的可达点做移动与到达判定,修复路点摆在空中/崖外时永不到达而卡死;吸附失败显式报错暴露误配,不静默兜底

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-22 15:52:18 +08:00
co-authored by Claude Opus 4.8
parent 7f7d237915
commit 132cd24908
5 changed files with 79 additions and 2 deletions
@@ -69,6 +69,14 @@ namespace BaseGames.Enemies
/// </summary>
bool WalkToRandomOnSegment();
/// <summary>
/// 目标点吸附:把任意世界 <paramref name="target"/> 映射到最近可行走段、并按敌人身体宽度从段两端内缩,
/// 得到"身体真正站得住"的点 <paramref name="standable"/>(避免落在角色宽度站不住的崖沿被移动层夹停)。
/// 身体宽度只属于导航执行层——意图层(AI/Locomotion)递原始目标即可,无需自行计算宽度。
/// target 离导航面太远(超出搜索半径)时返回 falsestandable 回落为原始 target。
/// </summary>
bool ResolveStandablePoint(Vector2 target, out Vector2 standable);
// ── 连接段事件 ──────────────────────────────────────────────────
/// <summary>开始穿越连接段时触发(传入连接段类型)。</summary>
event Action<NavLinkType> OnLinkStarted;
@@ -99,6 +107,7 @@ namespace BaseGames.Enemies
public bool CanReach(Vector2 _) => false;
public bool WalkToRandom() => false;
public bool WalkToRandomOnSegment() => false;
public bool ResolveStandablePoint(Vector2 target, out Vector2 standable) { standable = target; return false; }
public event Action<NavLinkType> OnLinkStarted { add { } remove { } }
public event Action<NavLinkType> OnLinkCompleted{ add { } remove { } }
public event Action OnNavPathFailed { add { } remove { } }