mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-12 02:19:49 +08:00
43 lines
761 B
Dart
43 lines
761 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import '../particle_component.dart';
|
|
|
|
class ComposedParticle extends Particle {
|
|
final List<Particle> children;
|
|
|
|
ComposedParticle({
|
|
@required this.children,
|
|
double lifespan,
|
|
Duration duration,
|
|
}) : super(
|
|
lifespan: lifespan,
|
|
duration: duration,
|
|
);
|
|
|
|
@override
|
|
void setLifespan(double lifespan) {
|
|
super.setLifespan(lifespan);
|
|
|
|
for (var child in children) {
|
|
child.setLifespan(lifespan);
|
|
}
|
|
}
|
|
|
|
@override
|
|
void render(Canvas c) {
|
|
for (var child in children) {
|
|
child.render(c);
|
|
}
|
|
}
|
|
|
|
@override
|
|
void update(double dt) {
|
|
super.update(dt);
|
|
|
|
for (var child in children) {
|
|
child.update(dt);
|
|
}
|
|
}
|
|
} |