moveAlongThePath method

void moveAlongThePath(
  1. List<Vector2> path, {
  2. VoidCallback? onFinish,
})

Makes the component follow a previously calculated path.

Implementation

void moveAlongThePath(
  List<Vector2> path, {
  VoidCallback? onFinish,
}) {
  if (!_comp.hasGameRef) {
    return;
  }

  if (onFinish != null) {
    _onFinishCallbacks.add(onFinish);
  }
  _currentIndex = 0;
  _removeLinePathComponent();

  _currentPath = path;
  _addLinePathComponent();
}