SimpleDirectionAnimation constructor

SimpleDirectionAnimation({
  1. required FutureOr<SpriteAnimation> idleLeft,
  2. required FutureOr<SpriteAnimation> idleRight,
  3. required FutureOr<SpriteAnimation> runRight,
  4. required FutureOr<SpriteAnimation> runLeft,
  5. FutureOr<SpriteAnimation>? idleUp,
  6. FutureOr<SpriteAnimation>? idleDown,
  7. FutureOr<SpriteAnimation>? idleUpLeft,
  8. FutureOr<SpriteAnimation>? idleUpRight,
  9. FutureOr<SpriteAnimation>? idleDownLeft,
  10. FutureOr<SpriteAnimation>? idleDownRight,
  11. FutureOr<SpriteAnimation>? runUp,
  12. FutureOr<SpriteAnimation>? runDown,
  13. FutureOr<SpriteAnimation>? runUpLeft,
  14. FutureOr<SpriteAnimation>? runUpRight,
  15. FutureOr<SpriteAnimation>? runDownLeft,
  16. FutureOr<SpriteAnimation>? runDownRight,
  17. Map<String, FutureOr<SpriteAnimation>>? others,
  18. SimpleAnimationEnum initAnimation = SimpleAnimationEnum.idleRight,
})

Implementation

SimpleDirectionAnimation({
  required FutureOr<SpriteAnimation> idleLeft,
  required FutureOr<SpriteAnimation> idleRight,
  required FutureOr<SpriteAnimation> runRight,
  required FutureOr<SpriteAnimation> runLeft,
  FutureOr<SpriteAnimation>? idleUp,
  FutureOr<SpriteAnimation>? idleDown,
  FutureOr<SpriteAnimation>? idleUpLeft,
  FutureOr<SpriteAnimation>? idleUpRight,
  FutureOr<SpriteAnimation>? idleDownLeft,
  FutureOr<SpriteAnimation>? idleDownRight,
  FutureOr<SpriteAnimation>? runUp,
  FutureOr<SpriteAnimation>? runDown,
  FutureOr<SpriteAnimation>? runUpLeft,
  FutureOr<SpriteAnimation>? runUpRight,
  FutureOr<SpriteAnimation>? runDownLeft,
  FutureOr<SpriteAnimation>? runDownRight,
  Map<String, FutureOr<SpriteAnimation>>? others,
  SimpleAnimationEnum initAnimation = SimpleAnimationEnum.idleRight,
}) {
  _currentType = initAnimation;
  _loader.add(AssetToLoad(idleLeft, (value) => this.idleLeft = value));
  _loader.add(AssetToLoad(idleRight, (value) => this.idleRight = value));
  _loader.add(AssetToLoad(idleDown, (value) => this.idleDown = value));
  _loader.add(AssetToLoad(idleUp, (value) => this.idleUp = value));
  _loader.add(AssetToLoad(idleUpLeft, (value) => this.idleUpLeft = value));
  _loader.add(AssetToLoad(idleUpRight, (value) {
    return this.idleUpRight = value;
  }));
  _loader.add(AssetToLoad(idleDownLeft, (value) {
    return this.idleDownLeft = value;
  }));
  _loader.add(AssetToLoad(idleDownRight, (value) {
    return this.idleDownRight = value;
  }));
  _loader.add(AssetToLoad(runUp, (value) => this.runUp = value));
  _loader.add(AssetToLoad(runRight, (value) => this.runRight = value));
  _loader.add(AssetToLoad(runDown, (value) => this.runDown = value));
  _loader.add(AssetToLoad(runLeft, (value) => this.runLeft = value));
  _loader.add(AssetToLoad(runUpLeft, (value) => this.runUpLeft = value));
  _loader.add(AssetToLoad(runUpRight, (value) => this.runUpRight = value));
  _loader.add(AssetToLoad(runDownLeft, (value) {
    return this.runDownLeft = value;
  }));
  _loader.add(AssetToLoad(runDownRight, (value) {
    return this.runDownRight = value;
  }));

  others?.forEach((key, anim) {
    _loader.add(AssetToLoad(anim, (value) {
      return this.others[key] = value;
    }));
  });
}