update method

  1. @override
void update(
  1. double dt
)
override

Implementation

@override
void update(double dt) {
  var found = 0;
  double newDt = 0.0;
  if (dt < _split) {
    newDt = 1;
    if (_split != 0) {
      newDt = dt / _split;
    }
    if (_last == 1) {
      _actionList[_last].update(0);
      _actionList[_last].stop();
    }
  } else {
    found = 1;
    if (_split == 1) {
      newDt = 1;
    } else {
      newDt = (dt - _split) / (1 - _split);
    }
    if (_last == -1) {
      _actionList[0].startWithTarget(getTarget());
      _actionList[0].update(1);
      _actionList[0].stop();
    }
    if (_last == 0) {
      _actionList[0].update(1);
      _actionList[0].stop();
    }
  }
  var actionFound = _actionList[found];
  if (_last == found && actionFound.isDone()) {
    return;
  }
  if (_last != found) {
    actionFound.startWithTarget(getTarget());
  }
  newDt = newDt * actionFound.getTimesForRepeat();
  if (newDt > 1) {
    newDt %= 1;
  }
  actionFound.update(newDt);
  _last = found;
}