Exemplo n.º 1
0
 public AStar()
 {
     openLinkedList = new LinkedList <PathNode>();
     path           = new Path();
     //openList = new List<PathNode>();
     newOpenList       = new List <PathNode>();
     myThread          = new Thread(new ThreadStart(FindWay));
     myThread.Priority = ThreadPriority.Lowest;
     threadNumber++;
     myThread.Name = "Enemy Thread #" + threadNumber.ToString();
     PathFound    += new PathFoundEventHandler(AStar_PathFound);
     searchMap     = new PathNode[AStarMap.Mapnodes.GetLength(0), AStarMap.Mapnodes.GetLength(1)];
     for (int i = 0; i < AStarMap.Mapnodes.GetLength(0); i++)
     {
         for (int k = 0; k < AStarMap.Mapnodes.GetLength(1); k++)
         {
             Node node = AStarMap.Mapnodes[i, k];
             searchMap[i, k] = new PathNode(node.MapXPosition, node.MapYPosition, node.Walkable);
         }
     }
 }
Exemplo n.º 2
0
 public AStar()
 {
     openLinkedList = new LinkedList<PathNode>();
     path = new Path();
     //openList = new List<PathNode>();
     newOpenList = new List<PathNode>();
     myThread = new Thread(new ThreadStart(FindWay));
     myThread.Priority = ThreadPriority.Lowest;
     threadNumber++;
     myThread.Name = "Enemy Thread #" + threadNumber.ToString();
     PathFound += new PathFoundEventHandler(AStar_PathFound);
     searchMap = new PathNode[AStarMap.Mapnodes.GetLength(0), AStarMap.Mapnodes.GetLength(1)];
     for (int i = 0; i < AStarMap.Mapnodes.GetLength(0); i++)
     {
         for (int k = 0; k < AStarMap.Mapnodes.GetLength(1); k++)
         {
             Node node = AStarMap.Mapnodes[i,k];
             searchMap[i, k] = new PathNode(node.MapXPosition, node.MapYPosition, node.Walkable);
         }
     }
 }