Provides access to data and methods related to an A* traveler.
travelPath | Accesses the traveler's current travel path. |
getAllocations | Gets an array of AStar.Allocations that the traveler has currently allocated or is scheduled to have allocated at a given time. |
Accesses the traveler's current travel path.
A traveler's travelPath describes the current sequence of A* grid cells that the traveler will traverse in traveling to its current destination. The travelPath can be accessed using array-type usage, including using the "length" property and array accessors.
for (int i = 1; i <= traveler.travelPath.length; i++) {
AStar.Cell cell = traveler.travelPath[i].cell;
...
}
Each element of the travelPath includes the AStar.Cell to be traversed.
AStar.Cell cell = traveler.travelPath[1].cell;
The travelPath also includes an indexOf() method to find which index (if any) corresponds to a given grid cell.
int index = traveler.travelPath.indexOf(cell);
getAllocations( double time = -1 ) |
time | The target time for retrieving the set of allocations. |
Gets an array of AStar.Allocations that the traveler has currently allocated or is scheduled to have allocated at a given time.
The allocations can be accessed as an array, including using the length property and array accessor.
var allocations = traveler.getAllocations();
for (int i = 1; i <= allocations.length; i++) {
AStar.Cell cell = allocations[i].cell;
}
Note that a traveler's allocations are correlated with, yet distinct from, a traveler's travelPath. Each entry in a traveler's path can have up to 3 allocations associated with it, specifically when the traveler is traveling diagonally. For example, if a traveler's travelPath includes a traversal from cell (4, 4) to cell (5, 5), the traveler would need to allocate, as part of traversing that diagonal, cells (4, 5) and (5, 4), in addition to the destination cell (5, 5).