feat: removed Component from Blueprint

pull/218/head
alestiago 3 years ago
parent 38602c8dba
commit d81546c84d

@ -29,9 +29,12 @@ void main() {
'loads correctly', 'loads correctly',
(game) async { (game) async {
final spaceshipRamp = SpaceshipRamp(); final spaceshipRamp = SpaceshipRamp();
await game.ensureAdd(spaceshipRamp); await game.addFromBlueprint(spaceshipRamp);
await game.ready();
expect(game.contains(spaceshipRamp), isTrue); for (final component in spaceshipRamp.components) {
expect(game.contains(component), isTrue);
}
}, },
); );

@ -1,16 +1,13 @@
import 'package:flame/components.dart'; import 'package:flame/components.dart';
import 'package:flame/game.dart'; import 'package:flame/game.dart';
// TODO(erickzanardo): Keeping this inside our code base // TODO(erickzanardo): Keeping this inside our code base so we can experiment
// so we can experiment with the idea, but this is a // with the idea, but this is a potential upstream change on Flame.
// potential upstream change on Flame.
/// {@template blueprint} /// {@template blueprint}
/// A [Blueprint] is a virtual way of grouping [Component]s that are related, /// A [Blueprint] is a virtual way of grouping [Component]s that are related.
/// but they need to be added directly on the [FlameGame] level.
/// {@endtemplate blueprint} /// {@endtemplate blueprint}
// TODO(alestiago): refactor with feat/make-blueprint-extend-component. class Blueprint {
class Blueprint extends Component {
/// {@macro blueprint} /// {@macro blueprint}
Blueprint({ Blueprint({
Iterable<Component>? components, Iterable<Component>? components,

Loading…
Cancel
Save