I am surprised that you don’t combine the evaluation of HasPath and GetPathLength when determining moveActions valid cells. Having a single call to pathfinding from MoveAction (line 100ish) would be much faster on larger grids.
If I combine the calls, will i regret this for some reason in the future?
float pathLength =
Pathfinding
.Instance
.GetPathLength(unitGridPosition, testGridPosition) /
Pathfinding.PathfindingDistanceMultiplier;
if (pathLength == 0)
{
// no path found
continue;
}
if (pathLength > maxMoveDistance)
{
// point is too far away
continue;
}