mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-04 04:47:13 +08:00 
			
		
		
		
	Pause effects
This commit is contained in:
		@ -23,7 +23,7 @@ abstract class Component {
 | 
				
			|||||||
  @mustCallSuper
 | 
					  @mustCallSuper
 | 
				
			||||||
  void update(double dt) {
 | 
					  void update(double dt) {
 | 
				
			||||||
    _effects.removeWhere((e) => e.hasFinished());
 | 
					    _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].
 | 
					  /// Renders this component on the provided Canvas [c].
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,11 @@ abstract class ComponentEffect<T extends Component> {
 | 
				
			|||||||
  bool _isDisposed = false;
 | 
					  bool _isDisposed = false;
 | 
				
			||||||
  bool get isDisposed => _isDisposed;
 | 
					  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
 | 
					  /// If the animation should first follow the initial curve and then follow the
 | 
				
			||||||
  /// curve backwards
 | 
					  /// curve backwards
 | 
				
			||||||
  bool isInfinite;
 | 
					  bool isInfinite;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user