using System.Collections.Generic; namespace BaseGames.AI { /// /// 不可变状态图,每敌人类型构建一次、所有实例共享(flyweight)。 /// 既被 AiRuntime 执行,又被导出器/调试器只读投影。 /// public sealed class AiGraph { readonly Dictionary _states; public string EntryState { get; } public IReadOnlyList GlobalTransitions { get; } public AiGraph(string entry, Dictionary states, IReadOnlyList globals) { EntryState = entry; _states = states; GlobalTransitions = globals; } public AiState GetState(string name) => _states[name]; public bool HasState(string name) => _states.ContainsKey(name); public IEnumerable StateNames => _states.Keys; public IEnumerable States => _states.Values; } }