Hello, in a turn-based game I’m using the following code to calculate the possible nodes reachable with the unit’s movement:
var path = ConstantPath.Construct(unit.transform.position, movementPoints);
path.traversalProvider = unit.traversalProvider;
AstarPath.StartPath(path);
path.BlockUntilCalculated();
foreach (var node in path.allNodes) {
if (node != path.startNode) {
//here I take each possible node and highlight it in the map
}
}
It all works fine, and also I can make the unit move along the path to the selected node. But I have no idea how to find out the exact movement cost for each node (including *1.5 heuristic for diagonals). the thing is, I need this figure to show the movement point cost in the UI, and to deduct it from the unit movement for that turn, so the player can perform the movement in different small steps if he wants.
I am using the Pro version.
Any help would be welcome!