Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: IEnumerable<TCell> GetPathTo<TCell>(this Dictionary<TCell, CellWithDistance<TCell>>, TCell)

Declaration

public static IEnumerable<TCell> GetPathTo<TCell>(
    this Dictionary<TCell, CellWithDistance<TCell>> paths,
    TCell destination
)

Summary

Given the output from Structure<TCell>.FindPath(TCell, TCell), reconstructs a path from the origin cell to the specified destination cell.

Generic type parameters

TCell Type of cell (e.g., Square, Hex or Tri).

Parameters

this Dictionary<TCell, CellWithDistance<TCell>>paths The output from Structure<TCell>.FindPath(TCell, TCell).
TCelldestination The destination cell to reconstruct the path to.

Returns

A collection containing every cell along the path, including the origin cell and destination.

Exceptions

  • System.InvalidOperationException
    The specified dictionary does not contain the required information to reconstruct the path.