// Use this for initialization
    private void Start()
    {
        Graph  graph = new Graph();
        A_Star astar = new A_Star();

        Node node0  = graph.GetNodes()[0];
        Node node8  = graph.GetNodes()[7];
        Node node24 = graph.GetNodes()[24];

        this.OutputPaths(astar.Search(node0, node24));
    }
Esempio n. 2
0
    // Start is called before the first frame update
    private void Start()
    {
        Graph  graph = new Graph();
        A_Star astar = new A_Star();

        Node node0  = graph.GetNodes()[0];
        Node node8  = graph.GetNodes()[7];
        Node node24 = graph.GetNodes()[24];

        this.paths = new List <Node>();
        this.paths = astar.Search(node0, node24);

        this.currentPosition = new Vector2(paths[this.index].GetX(), paths[this.index].GetZ());
        this.nextPosition    = new Vector2(paths[this.index + 1].GetX(), paths[this.index + 1].GetZ());

        //this.OutputPaths(paths);

        StartCoroutine(this.OnMovement());
    }