moveToPositionWithPathFinding method
Future<List<Vector2> >
moveToPositionWithPathFinding(
- Vector2 position, {
- List<
GameComponent> ? ignoreCollisions, - VoidCallback? onFinish,
Implementation
Future<List<Vector2>> moveToPositionWithPathFinding(
Vector2 position, {
List<GameComponent>? ignoreCollisions,
VoidCallback? onFinish,
}) async {
if (!hasGameRef) {
return Future.value([]);
}
_onFinish = onFinish;
_currentIndex = 0;
_removeLinePathComponent();
_currentPath = await Future.microtask(
() => getPathToPosition(
position,
ignoreCollisions: ignoreCollisions,
),
);
_addLinePathComponent();
return _currentPath;
}