Exemplo n.º 1
0
    public List <Node> ReturnPath(Node start, Node end, PathFindingMethod p)
    {
        _start = start;
        _end   = end;
        if (_start == null || _end == null)
        {
            return(null);
        }

        _nodesChecked = new List <Node>();
        _nodesChecked.Clear();

        List <Node> path = null;

        switch (p)
        {
        case PathFindingMethod.ASTAR:
            path = AStar.Run(_start, Satisfies, GetWeightedNeighbours, Heuristic);
            break;

        case PathFindingMethod.THETA:
            path = ThetaStar.Run(_start, Satisfies, GetWeightedNeighbours, Heuristic, InSight, EuclideanDist);
            break;
        }



        return(path);
    }
Exemplo n.º 2
0
    private void Start()
    {
        var path = ThetaStar.Run(start, satisfies, Expand, heuristic, insigth, cost);

        foreach (var nodo in path)
        {
            Debug.Log(nodo.name);
        }

        walker.waypoints = path;
    }
Exemplo n.º 3
0
    private void Start()
    {
        List <Nodo> path = new List <Nodo>();

        //Aca va a cambiar el método.
        switch (method)
        {
        case FindingMethod.BFS:
            path = BFS.Run(start, satisfies, Expand);
            break;

        case FindingMethod.DFS:
            path = DFS.Run(start, satisfies, Expand);
            break;

        case FindingMethod.Dijkstra:
            path = Dijkstra.Run(start, satisfies, ExpandWeighted);
            break;

        case FindingMethod.AStar:
            path = AStar.Run(start, satisfies, ExpandWeighted, heuristic);
            break;

        case FindingMethod.ThetaStar:
            path = ThetaStar.Run(start, satisfies, ExpandWeighted, heuristic, insigth, cost);
            break;

        default:
            break;
        }

        // foreach (var nodo in path )
        // {
        //     Debug.Log(nodo.name);
        // }

        walker.waypoints = path;
    }
Exemplo n.º 4
0
    private BaseSearchAlgo GetAlgorithm()
    {
        BaseSearchAlgo algo = null;

        switch (m_searchAlgo)
        {
        case SearchAlgo.A_Star:
            algo = new AStar(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.Theta_Star:
            algo = new ThetaStar(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.LazyTheta_Star:
            algo = new LazyThetaStar(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.BestFirstSearch:
            algo = new BestFirstSearch(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.BreadthFirstSearch:
            algo = new BreadthFirstSearch(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.DijkstraSearch:
            algo = new DijkstraSearch(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.JPS:
            algo = new JumpPointSearch(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.JPSPlus:
            algo = new JPSPlus(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

        case SearchAlgo.BiA_Star:
            algo = new BiAStar(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime);
            break;

            #region Incremental
        case SearchAlgo.D_Star:
            algo = new DStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.FocussedD_Star:
            algo = new FocussedDStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.LPA_Star:
            algo = new LPAStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            //algo = new LPAStar_Optimized(m_startNode, m_endNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.DstarLite:
            algo = new DStarLite(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.Path_AA_Star:
            algo = new Path_AAStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.Tree_AA_Star:
            algo = new Tree_AAStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;
            #endregion

            #region Moving Target
        case SearchAlgo.GAA_Star:
            algo = new GAAStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.GFRA_Star:
            algo = new GFRAStar(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;

        case SearchAlgo.MT_DstarLite:
            algo = new MT_DStarLite(m_startNode, m_goalNode, m_nodes, m_showTime);
            break;
            #endregion

        case SearchAlgo.AnnotatedA_Star:
            algo = new AnnotatedAStar(m_startNode, m_goalNode, m_nodes, m_weight, m_showTime, m_unitSize);
            break;

        default:
            Debug.LogError($"No code for SearchAlgo={m_searchAlgo}");
            break;
        }

        return(algo);
    }