mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-04 04:47:13 +08:00
Fix alternation bug of combined effect
This commit is contained in:
@ -75,12 +75,14 @@ class MyGame extends BaseGame with TapDetector {
|
|||||||
isAlternating: false,
|
isAlternating: false,
|
||||||
isInfinite: false,
|
isInfinite: false,
|
||||||
);
|
);
|
||||||
|
combination.onComplete = () => print("combination complete");
|
||||||
|
|
||||||
final sequence = SequenceEffect(
|
final sequence = SequenceEffect(
|
||||||
effects: [move1, scale, combination],
|
effects: [move1, scale, combination],
|
||||||
isInfinite: false,
|
isInfinite: false,
|
||||||
isAlternating: true,
|
isAlternating: true,
|
||||||
);
|
);
|
||||||
|
sequence.onComplete = () => print("sequence complete");
|
||||||
greenSquare.addEffect(sequence);
|
greenSquare.addEffect(sequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,10 +53,6 @@ class CombinedEffect extends PositionComponentEffect {
|
|||||||
if (effects.every((effect) => effect.hasFinished())) {
|
if (effects.every((effect) => effect.hasFinished())) {
|
||||||
if (isAlternating && curveDirection.isNegative) {
|
if (isAlternating && curveDirection.isNegative) {
|
||||||
effects.forEach((effect) => effect.isAlternating = true);
|
effects.forEach((effect) => effect.isAlternating = true);
|
||||||
} else if (isInfinite) {
|
|
||||||
reset();
|
|
||||||
} else if (isAlternating && isMin()) {
|
|
||||||
dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,11 +92,6 @@ class CombinedEffect extends PositionComponentEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool hasFinished() {
|
|
||||||
return super.hasFinished() && effects.every((e) => e.hasFinished());
|
|
||||||
}
|
|
||||||
|
|
||||||
void _maybeReverse(PositionComponentEffect effect) {
|
void _maybeReverse(PositionComponentEffect effect) {
|
||||||
if (isAlternating && !effect.isAlternating && effect.isMax()) {
|
if (isAlternating && !effect.isAlternating && effect.isMax()) {
|
||||||
// Make the effect go in reverse
|
// Make the effect go in reverse
|
||||||
|
|||||||
Reference in New Issue
Block a user