Ejemplo n.º 1
0
    //void Start () {
    //    for(int j = 0; j < 7; j++)
    //    {
    //print(DijkstraAlg(graph, 0, 7)[j]);
    //print(DijkstraAlgReturnPath(graph, 0, 7)[j]);
    //        print(FindShortestPath(7, 4)[j]);
    //    }

    //}

    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            print("You pressed w my dude.");
            int[] shortestPath = FindShortestPath(points.Length, targetPoint);
            for (int i = 0; i < points.Length - 1; i++)
            {
                //print("your deals should have moved.");
                //print(points[shortestPath[i + 1]]);
                spanner.CreateSpan(points[shortestPath[i]], points[shortestPath[i + 1]], midPoints, i);
            }
        }
    }
Ejemplo n.º 2
0
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            //Rearrange the points array with the selected one on top

            selPointFirst[0] = points[startingPoint];
            for (int v = 0; v < points.Length - 1; v++)
            {
                selPointFirst[v + 1] = points[v + 1];
            }
            selPointFirst[startingPoint] = points[0];

            print("You pressed w my dude.");
            int[] shortestPath = FindShortestPath(selPointFirst.Length, targetPoint);
            for (int i = 0; i < selPointFirst.Length - 1; i++)
            {
                //print("your deals should have moved.");
                //print(points[shortestPath[i + 1]]);
                spanner.CreateSpan(selPointFirst[shortestPath[i]], selPointFirst[shortestPath[i + 1]], midPoints, i);
            }
        }
    }