/// <summary> /// This function will add a new thread worker for A* algorithm to run on. /// </summary> /// <param name="StartingNode">The starting position in (Array coordinates) of the search path.</param> /// <param name="TargetNode">The target or destination position in (Array coordinates) where the search for the path will end at.</param> /// <param name="map">Map class.</param> /// <param name="DisableDiagonalPathfinding">If true, the A* algorithm will not search the path in diagonal direction.</param> /// <param name="WorkerIDNumber">ID number for this worker thread so you can get the results back.</param> public static void AddNewThreadWorker(Node StartingNode, Node TargetNode, Game game, SimpleTileLayer layer, bool DisableDiagonalPathfinding, string WorkerIDNumber) { ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { AstarThreadWorker astarWorker = new AstarThreadWorker(StartingNode, TargetNode, game, layer, DisableDiagonalPathfinding, WorkerIDNumber); AstarThreadWorkerResults.Enqueue(astarWorker); })); }
/// <summary> /// This function will add a new thread worker for A* algorithm to run on. /// </summary> /// <param name="StartingNode">The starting position in (Array coordinates) of the search path.</param> /// <param name="TargetNode">The target or destination position in (Array coordinates) where the search for the path will end at.</param> /// <param name="map">Map class.</param> /// <param name="DisableDiagonalPathfinding">If true, the A* algorithm will not search the path in diagonal direction.</param> /// <param name="WorkerIDNumber">ID number for this worker thread so you can get the results back.</param> public static void AddNewThreadWorker(Node StartingNode, Node TargetNode, Map map, bool DisableDiagonalPathfinding, int WorkerIDNumber) { ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { AstarThreadWorker astarWorker = new AstarThreadWorker(StartingNode, TargetNode, map, DisableDiagonalPathfinding, WorkerIDNumber); AstarThreadWorkerResults.Enqueue(astarWorker); })); }