Commit Graph
14 Commits
Author SHA1 Message Date
joywayerandClaude Opus 4.8 31b77fa473 feat(enemy): Wander 巡逻改为当前段内随机 + 按身体宽度内缩两端
修复地面单位 Wander 巡逻"走一小段就停":
- 随机点从全图(GetRandomPointOnGraph)改为限定在 agent 当前所站的 NavSegment 上,
  不再跨越跳/落/拐角 NavLink,避免路径跨沟被崖边夹停或卡在过不去的 link。
- 段内随机 t 按"身体前缘安全余量(碰撞体半宽 + 悬崖检测前向偏移)"从两端各内缩,
  避免随机点落在角色宽度站不住的崖沿(WouldFallAhead 夹停、IsFollowingAPath 不复位→卡死)。
- NavAgent.SetRandomDestinationOnCurrentSegment(endMargin):段内采样+内缩(段过短退化到中点)
- EnemyMovement.EdgeSafeMargin:身体前缘安全余量
- IPathAgent.WalkToRandomOnSegment():EnemyNavAgent 传入 margin;飞行单位复用局部偏移;Null 返回 false

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 12:45:01 +08:00
joywayer 1a15473966 @
fix(enemy): 转身中不再静默丢弃新朝向请求,修"冲刺方向与朝向相反"

UpdateFacing 原 `if (_isTurning) return` 会把转身进行中的新朝向请求静默丢弃。
当敌人在平台边缘触发 Pace 翻转(开始 Flip 转身)同时进入追击时,追击的
FaceDirection(朝玩家)被丢弃,旧的巡逻转身完成后朝向定格在与玩家相反方向
→ 冲刺朝玩家方向移动、脸却朝相反(并连带"冲刺中途转身""提前停"两个衍生现象)。

改为:转身中收到不同方向请求时重定向(停旧转身按新方向重起),同向则忽略。
根因修复,惠及 Pace/追击/FaceTarget 所有调用方。

systematic-debugging 确定性复现证实:修复前 AFTER-TURN dir=+1 facing=-1;
修复后开阔地冲刺全程 dir=1 facing=1、冲满 6 米到真实平台边缘才停。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-07-20 13:03:29 +08:00
joywayer bd8e0a4f16 @
refactor(enemy): _wallMask 未配显式报错,不再静默回退地面层

按 CLAUDE.md §6:删除"_wallMask 为空则回退 _groundMask"的下游兜底(掩盖漏配)。
改为:WouldHitWallAhead/WallAndLedgeCheck 直接用 _wallMask;Awake 校验——启用
墙检测(_wallCheckDist>0)却 _wallMask=Nothing 时 Debug.LogError 提醒策划配置
(推荐 Platform+Wall)。

PlayMode 验证:E001(已配 Platform+Wall)无报错、撞墙检测正常;临时配错的敌人
(wallMask=Nothing) Awake 即报明确错误。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-07-20 10:36:11 +08:00
joywayer 88fca8f9b0 @
fix(enemy): 撞墙检测层默认 Platform+Wall(策划可配) + 修 Physics2D 层矩阵落盘

- EnemyMovement._wallMask:本就 [SerializeField] 暴露在 Inspector,补 Tooltip
  说明为策划可配的撞墙检测层(巡逻翻边/追击冲刺共用,按碰撞体前缘);脚手架
  PlaceE001 默认赋 Platform+Wall,prefab 同步。原先 Nothing→回退 groundMask,
  漏检 Wall 层墙;现显式含 Wall。回退逻辑保留作未配置兜底。
- Physics2DLayerReport.SavePhysicsSettings:原实现(AssetDatabase.SaveAssets+
  改 defaultContactOffset)不落盘层矩阵——实测 Physics2D.IgnoreLayerCollision 的
  改动 SaveToSerializedFileAndForget(单例) 也捕获不到;改用 File/Save Project
  (实测 hash 变化确认落盘,且不触动打开场景)。Auto Fix 的矩阵修正现能立即持久化。

(说明:Enemy×Player 碰撞矩阵与报告 ExpectedPairs 此前已正确=忽略,无需改动;
地图障碍物层管理/冲刺可穿透障碍另行整体规划。)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-07-20 10:32:07 +08:00
joywayer f1ca62f881 @
feat(enemy): 追击(nav)也夹紧悬崖边缘——碰撞体前缘不越地形边缘

MoveWithSpeed(导航跟段驱动追击)原先无边缘夹紧,仅靠 nav 图,agent 按点定位
可让碰撞体前缘越出段/地形边缘约半个碰撞体宽。现加"悬崖"夹紧(WouldFallAhead,
按碰撞体前缘即时判定),贴地生效:追击时碰撞体边缘停在地形边缘、不越界,与 Pace
一致。只夹悬崖不夹墙(墙交寻路绕行,免误夹停);跨沟的 nav-link 跳/落不经
MoveWithSpeed(仅 IsMovingOnSegment 时写速度),故不影响跳跃/下落过沟。

WouldBlockAhead 拆为 WouldHitWallAhead / WouldFallAhead 复用;PlayMode 校验
拆分正确(前缘朝悬崖侧 WouldFall=True)、Pace 不回归。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-07-10 15:48:58 +08:00
joywayer a4b9729de7 @
fix(enemy): 巡逻边缘不越界 + 卡死兜底 + Locomotion 惰性发现

- WouldBlockAhead(EnemyMovement):按请求方向从碰撞体前缘(bounds.max/min.x)
  即时射线判墙/悬崖,天然考虑碰撞体宽度;MoveHorizontal 据此夹紧前进,保证
  "碰撞体边缘停在地形边缘、不越界"。移动层夹紧与 Pace 翻向共用同一判定,
  避免"夹停却不掉头"。nav 走 MoveWithSpeed 不受影响。
- Pace 加窗口净位移卡死兜底:撞上未挂检测层的墙/卡角(含贴墙微抖)也能翻向,
  用净位移而非逐帧差以免微抖重置计数。
- EnemyBase.Locomotion 改惰性发现:关域重载下 Awake 设的实例字段可能残留
  为 null,首次访问按需补发现,编辑器/构建都不为空(此前致入口态偶发 NRE)。

PlayMode(跨调用取样,避免 Thread.Sleep 冻结主线程)验证:Pace 来回踱步、
遇边缘/墙掉头、碰撞体不越界。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-07-10 15:12:28 +08:00
joywayerandClaude Opus 4.8 6a34b42db0 fix(enemy): 终审修复——删死代码群体警戒、修 Waypoints 到达推进、补 Locomotion 缺失报错
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 14:05:56 +08:00
joywayerandClaude Opus 4.8 490329e1dc refactor(nav): 敌人移动改为物理原生架构——根治 TBM 与 Dynamic 刚体冲突
根因: NavAgent.Position setter 直接写 transform.position, TBM 段移动每帧写它, 与敌人
Dynamic 刚体(重力/碰撞)冲突(旧代码靠"NavDriving清零velocity"缓解,但对Dynamic刚体直接
写transform.position本就不推荐,易卡墙/穿透/被物理覆盖)。

根本解: 寻路降为"顾问"(只给方向),移动执行归物理:
- EnemyNavAgent.Awake 禁用 TBM.SegmentMovement(不再写 transform.position);
- FixedUpdate 改物理原生桥: 朝 PathSubGoal 写 MoveDir+MoveSpeed 由 EnemyMovement 施加
  velocity+重力执行, 到达子目标时 CompleteSegmentTraversal 推进段(原由TBM负责);
- EnemyMovement 撤掉 NavDriving 的清零velocity/只朝向门, nav方向统一走velocity移动。
保留击退/击飞/落地等全部物理反馈。

附带修 PerceptionStateMachine: 追击维持改"追逐区 OR 视野区"任一(视野los可能被墙挡漏检,
仅靠视野会导致玩家在近身追逐区内却Chase↔Patrol抖动、nav被反复Stop不移动)。

PlayMode 验证: 敌人 nav 巡逻/追击均用velocity移动(FollowPath/onSeg=True)、追击稳定无抖动。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 17:19:01 +08:00
joywayer 06048c966a feat: Add HurtBoxOwnerGuard to prevent multiple damage registrations from the same HitBox activation
- Implemented HurtBoxOwnerGuard to ensure that multiple HurtBoxes on the same character do not register damage multiple times during a single HitBox activation.
- Added custom editor for HitBox to facilitate the creation of shape colliders with HitBoxColliderProxy.
- Introduced PhysicsPerceptionSystem for enemy perception, supporting multiple detection modes including RangeCircle, BatchLOS, FanCast, and BoxCast.
- Created EnemyPatrolZone to define patrol and chase areas for enemies, allowing for shared zones among multiple enemies.
- Added BD_IsOutsideZone conditional task for Behavior Designer to check if an enemy or player is outside a defined patrol zone.
2026-06-02 16:10:44 +08:00
joywayer bcd8b0e90b feat: Update enemy AI and movement systems
- Enhanced Physics2D layer collision report with new interactions between Player and Enemy layers.
- Refactored BD_InvestigateLastKnown to streamline animation handling and improve readability.
- Simplified BD_MaintainCombatDistance by consolidating movement stop logic.
- Updated BD_MoveToPlayer to set AI phase on start.
- Improved BD_Patrol logic with better handling of stuck states and path failures.
- Enhanced BD_PatrolWaypoints to manage stuck conditions and retry logic more effectively.
- Refined BD_ReturnToHome to remove unnecessary animation calls.
- Updated BD_WalkRandom to ensure AI phase is set correctly on start.
- Improved EnemyAbilityBase to delegate target facing to the movement system.
- Enhanced EnemyBase with new movement methods for better control.
- Refactored EnemyMovement to introduce a new input system for handling movement and facing.
- Added EnemyMoveInput struct to encapsulate movement intentions.
- Updated Physics2DSettings to reflect new layer collision matrix.
- Introduced RTK CLI instructions for optimized command usage.
2026-05-29 17:01:59 +08:00
joywayer 5a0f1548ea Refactor code structure for improved readability and maintainability 2026-05-26 13:04:38 +08:00
joywayer a1b4e629aa feat: Implement Room Streaming System
- Add RoomStreamingManager to manage room loading and unloading based on player proximity.
- Create StreamingBudgetConfigSO for memory and performance budgeting of the streaming system.
- Introduce TransitionDirector to handle seamless and atmospheric fade transitions between rooms.
- Develop WorldGraph to represent room connectivity and facilitate neighbor queries and distance calculations.
- Implement RoomNode and RoomEdge classes to structure room data and connections.
2026-05-23 19:10:29 +08:00
joywayer b7baf7ad6a Add WeaponFeedback component and AddressableManagerWindow meta file
- Implemented WeaponFeedback class for handling weapon-related feedbacks such as hit effects and attack sounds.
- Added meta file for AddressableManagerWindow to manage addressable assets.
- Included a new jump.data file for profiler data.
2026-05-22 22:03:32 +08:00
joywayer f264329751 摄像机区域的架构改动 2026-05-15 14:47:24 +08:00