Beispiel #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);
    }
Beispiel #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;
    }
Beispiel #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;
    }