public void AddProxyManager(IProxyManager proxyManager) { if (proxyManager == null) { string msg = "BehaviorTreeManager.AddProxyManager() \n proxyManager is null."; LogError(msg); throw new Exception(msg); } EProxyType proxyType = proxyManager.GetProxyType(); if (m_ProxyManagers.Count == 0) { m_ProxyManagers.Add(proxyManager); } else { //插入排序,EProxyType的枚举值越大,优先级越高 for (int i = 0; i < m_ProxyManagers.Count; i++) { IProxyManager tempProxyManager = m_ProxyManagers[i]; EProxyType tempProxyType = tempProxyManager.GetProxyType(); if (tempProxyType < proxyType) { m_ProxyManagers.Insert(i, proxyManager); break; } } } }