Example #1
0
    /// <summary>
    /// Mark the edge between two grid squares as being changed
    /// </summary>
    /// <param name="x1">The x-coordinate of the source square.</param>
    /// <param name="y1">The y-coordinate of the source square.</param>
    /// <param name="x2">The x-coordinate of the destination square.</param>
    /// <param name="y2">The y-coordinate of the destination square.</param>
    /// <param name="cost">The new cost of the edge, set to Infinity to disable.</param>
    public void EdgeChanged(int x1, int y1, int x2, int y2, float cost)
    {
        GridCell src    = cells[GetIdx(x1, y1)];
        GridCell target = cells[GetIdx(x2, y2)];
        int      dir    = GetDirection(x1, y2, x2, y2);

        src.edges[dir] = cost;

        helper.MarkChanged(new GridEdge(src, target, cost));
    }