public void RegisterAITask(AIBase _ai) { if (dic_AI_list == null) { dic_AI_list = new Dictionary <string, SortedDictionary <int, List <AIBase> > >(); } if (!dic_AI_list.ContainsKey(_ai.GetID())) { dic_AI_list.Add(_ai.GetID(), new SortedDictionary <int, List <AIBase> >()); } if (!dic_AI_list[_ai.GetID()].ContainsKey(_ai.GetPriority())) { dic_AI_list[_ai.GetID()].Add(_ai.GetPriority(), new List <AIBase>()); } dic_AI_list[_ai.GetID()][_ai.GetPriority()].Add(_ai); }