runAction method

  1. @override
bool runAction(
  1. double dt,
  2. BonfireGameInterface game
)
override

Implementation

@override
bool runAction(double dt, BonfireGameInterface game) {
  if (!_running) {
    _running = true;
    if (position != null) {
      game.camera.moveToPositionAnimated(
        position: position!,
        effectController: EffectController(
          duration: duration.inSeconds.toDouble(),
          curve: curve,
        ),
        onComplete: _actionDone,
        angle: angle,
        zoom: zoom,
      );
    } else if (target != null) {
      game.camera.moveToTargetAnimated(
        target: target!,
        effectController: EffectController(
          duration: duration.inSeconds.toDouble(),
          curve: curve,
        ),
        onComplete: () {
          _actionDone.call();
          game.camera.follow(target!);
        },
        angle: angle,
        zoom: zoom,
      );
    } else {
      return true;
    }
  }
  if (_done) {
    return true;
  }
  return false;
}