示例#1
0
    int Distance(Node a, Node b)
    {
        Vector2Int d = Grid.Abs(a.gridIndex - b.gridIndex);

        if (d.x > d.y) // Try to take as many diagonal steps as possible (limited by the shortest one)
        {
            return(14 * d.y + 10 * (d.x - d.y));
        }
        return(14 * d.x + 10 * (d.y - d.x));
    }