/// <summary> /// Finds the nodes at the passed world grid indices and returns a queue of map objects to travel along in order to get from start /// to end. /// </summary> /// <param name="startWorldPosition"></param> /// <param name="endWorldPosition"></param> /// <returns></returns> private Queue <PathNode> FindBestPath(Vector startWorldPosition, Vector endWorldPosition) { PathNode start = currentMap.GetPathNodeAtWorldPosition(startWorldPosition); PathNode end = currentMap.GetPathNodeAtWorldPosition(endWorldPosition); Path <PathNode> bestPath = FindPath(start, end);//, ExactDistance, ManhattanDistance); IEnumerable <PathNode> bestPathReversed = bestPath.Reverse(); Queue <PathNode> result = new Queue <PathNode>(); foreach (var bestPathNode in bestPathReversed) { result.Enqueue(bestPathNode); } return(result); }