refactor(ai): EnemyBase/QuotaManager 移除 Opsive BT,改接 EnemyAiBrain(Brain访问器/Died信号/OnSpawn重置/LOD裁剪)
This commit is contained in:
@@ -101,23 +101,22 @@ namespace BaseGames.Enemies
|
||||
if (e != null) _indexMap[e] = i;
|
||||
}
|
||||
|
||||
#if GRAPH_DESIGNER
|
||||
for (int i = n - 1; i >= 0; i--)
|
||||
{
|
||||
var enemy = _registered[i];
|
||||
if (enemy == null) { _registered.RemoveAt(i); continue; }
|
||||
|
||||
var bt = enemy.BehaviorTree;
|
||||
var brain = enemy.Brain;
|
||||
bool active = i < _maxActiveBehaviorTrees;
|
||||
|
||||
if (bt != null && bt.enabled != active)
|
||||
if (brain != null && brain.enabled != active)
|
||||
{
|
||||
bt.enabled = active;
|
||||
// 禁用 brain 即停其 Update/Tick,等价于旧的禁用行为树。
|
||||
brain.enabled = active;
|
||||
// 同步暂停/恢复感知系统,避免远处敌人无效 tick
|
||||
enemy.SensorHub?.SetSuspended(!active);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user