Skip to content

PathFinding - price of point does not take effect #9

@likexoo

Description

@likexoo

Steps to reproduce

        float[,] tilesmap = new float[4, 4];
        for (int i = 0; i < 4; i++)
        {
            for (int ii = 0; ii < 4; ii++)
            {
                tilesmap[i, ii] = 3.0f; // <= price is 3
            }
        }

        NesScripts.Controls.PathFind.Grid grid = new NesScripts.Controls.PathFind.Grid(tilesmap);

        Point _from = new Point(0, 0);
        Point _to = new Point(3, 3);

        List<Point> path = Pathfinding.FindPath(grid, _from, _to, Pathfinding.DistanceType.Manhattan);

        foreach (Point p in path)
        {
            Debug.Log(p.x + " , " + p.y);
        }

        // path: (1,0) (1,1) (2,1) (2,2) (3,2) (3,3)

Expected result

According to my understanding, path should be:

(1,0) (1,0) (1,0) (1,1) (1,1) (1,1) (2,1) (2,1) (2,1) (2,2) (2,2) (2,2) (3,2) (3,2) (3,2) (3,3) (3,3) (3,3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions