diff --git a/Assets/_Game/Scripts/Enemies/EnemyBase.cs b/Assets/_Game/Scripts/Enemies/EnemyBase.cs index 1d3a809a..b0539825 100644 --- a/Assets/_Game/Scripts/Enemies/EnemyBase.cs +++ b/Assets/_Game/Scripts/Enemies/EnemyBase.cs @@ -1,5 +1,6 @@ using UnityEngine; using Animancer; +using BaseGames.AI; using BaseGames.Combat; using BaseGames.Core.Events; using BaseGames.Core.Pool; @@ -58,6 +59,9 @@ namespace BaseGames.Enemies // 通过接口引用,避免对 Navigation 程序集的直接依赖。 // 由子类 / Inspector 注入,或者运行时 GetComponent() 获取。 protected IPathAgent _nav; + + // 移动执行器(IEnemyLocomotion;由 EnemyLocomotion 在 Navigation 程序集实现,运行时发现) + protected IEnemyLocomotion _locomotion; // 霸体来源(由 EnemyPoiseComponent.Awake() 自动注入,TakeDamage 时读取) private IPoiseSource _poiseSource; protected readonly CompositeDisposable _subs = new(); @@ -214,6 +218,7 @@ namespace BaseGames.Enemies // BD 任务访问接口(公共只读属性)──────────────────────────────── public IPathAgent Nav => _nav; + public IEnemyLocomotion Locomotion => _locomotion; public EnemyMovement Movement => _movement; public EnemyStats Stats => _stats; /// 敌人配置 SO,供 BD Task / 状态对象读取配置数据(如 knockUpDuration)。 @@ -566,6 +571,7 @@ namespace BaseGames.Enemies _stateObjs[EnemyStateType.Dead] = new EnemyDeadState(); _nav = GetComponent() ?? new NullPathAgent(); + _locomotion = GetComponentInChildren(true); if (_movement == null) _movement = GetComponent(); _poiseSource = GetComponent(); _sensorHub = GetComponentInChildren();