mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 12:28:03 +08:00
Pause effects
This commit is contained in:
@ -23,7 +23,7 @@ abstract class Component {
|
||||
@mustCallSuper
|
||||
void update(double dt) {
|
||||
_effects.removeWhere((e) => e.hasFinished());
|
||||
_effects.forEach((e) => e.update(dt));
|
||||
_effects.where((e) => !e.isPaused).forEach((e) => e.update(dt));
|
||||
}
|
||||
|
||||
/// Renders this component on the provided Canvas [c].
|
||||
|
||||
@ -16,6 +16,11 @@ abstract class ComponentEffect<T extends Component> {
|
||||
|
||||
bool _isDisposed = false;
|
||||
bool get isDisposed => _isDisposed;
|
||||
|
||||
bool _isPaused = false;
|
||||
bool get isPaused => _isPaused;
|
||||
void resume() => _isPaused = false;
|
||||
void pause() => _isPaused = true;
|
||||
|
||||
/// If the animation should first follow the initial curve and then follow the
|
||||
/// curve backwards
|
||||
|
||||
Reference in New Issue
Block a user