예제 #1
0
    //Makes an edge from x_par to x_chl
    //Updates x_chl's cost by the sum of x_par's cost and the distance between x_par and x_chl
    private static void AddEdge(Sample x_par, Sample x_chl)
    {
        x_par.AddChild(x_chl);
        x_chl.parent = x_par;
        float dist = (x_par.pos - x_chl.pos).magnitude;

        x_chl.cost = x_par.cost + dist;
    }