예제 #1
0
 void Update()
 {
     if (results.Count > 0)
     {
         int itemsInQueue = results.Count;
         lock (results)
         {
             for (int i = 0; i < itemsInQueue; i++)
             {
                 PathResult result = results.Dequeue();
                 result.callback(result.path, result.success);
             }
         }
     }
 }
예제 #2
0
        private IEnumerator ReadPathfindingResults()
        {
            while (true)
            {
                yield return(_wfs);

                lock (results)
                {
                    //read only in case that we have a result queued up.
                    if (results.Count > 0)
                    {
                        PathResult result = results.Dequeue();

                        if (PathfindingAlgorithms.isDebugMode)
                        {
                            //AStar.DebugPath(result.path);

                            result.callback(result.path, result.success);
                        }
                    }
                }
            }
        }