feat(editor): 敌人 AI 配方脚手架向导;AssignModules 改名并失效缓存

- AiRecipeSO 新增 protected InvalidateGraph(),子类装配模块后调用以丢弃缓存图,
  避免改动要等到下次进 Play 才生效的静默陈旧图问题。
- PerceptionRecipeSO.SetModulesForTests 改名为 AssignModules(向导也要用它装配模块,
  旧名字具有误导性),并在装配后调用 InvalidateGraph。
- 新增 EnemyAiRecipeWizard:按 AssetFolderSpec 定名定路径创建感知型 AI 配方资产
  (Assets/_Game/Data/Enemies/{EnemyID}/ENM_{EnemyID}_Ai.asset),已存在则选中不覆盖。
- PerceptionRecipeSoTests 同步改名调用点,并新增测试钉住"装配后缓存必须失效"契约。
This commit is contained in:
2026-07-29 15:28:25 +08:00
parent 426fa3601d
commit ecdb0040cb
5 changed files with 108 additions and 3 deletions
@@ -23,10 +23,12 @@ namespace BaseGames.Enemies
protected override void Build(BrainBuilder b)
=> PerceptionSkeleton.Add(b, _unaware, _engagement);
/// <summary>仅供 EditMode 测试与脚手架向导装配模块,运行时不使用。</summary>
public void SetModulesForTests(IUnawareModule unaware, IEngagementModule engagement)
/// <summary>装配模块。供脚手架向导与 EditMode 测试使用,运行时不应调用
/// (本资产是 flyweight,运行时改它会影响所有引用该配方的敌人)。</summary>
public void AssignModules(IUnawareModule unaware, IEngagementModule engagement)
{
_unaware = unaware; _engagement = engagement;
InvalidateGraph();
}
}
}