//public int _threadFinishedCount = 0; // int _mSIdx;//main thread start idx in _allAgents // int _mEIdx;//main thread end idx in _allAgents public PathFindingManager(FP scale) { _tasks = new List <AgentsTask>(); _flowManager = new FlowFieldManager(); int taskCount = 0; // _destroyed = false; #if MULTI_THREAD int cps; ThreadPool.GetMinThreads(out taskCount, out cps); //#if UNITY_EDITOR UnityEngine.Debug.LogError("thread count______:" + taskCount); //#endif taskCount = 2; #endif // _taskEvents = new ManualResetEvent[taskCount]; _pathManagers = new PathManager[taskCount + 1]; int i = 0; for (i = 0; i < taskCount; i++) { AgentsTask task = AgentsTask.Create(i, this); _tasks.Add(task); // _taskEvents[i] = task._finished; _pathManagers[i] = new PathManager(); } _pathManagers[i] = new PathManager(); #if USING_DYNAMIC_TREE _dynamicTree = new DynamicTree <PathFindingAgentBehaviour>(); _dynamicTree.c_aabbExtension *= scale; #endif }