SimpleDirectionAnimation constructor
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< ? others,SpriteAnimation> > - 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;
}));
});
}