From d81546c84d8778ec3dc4373372bf83464c90cfa9 Mon Sep 17 00:00:00 2001 From: alestiago Date: Fri, 22 Apr 2022 04:02:30 +0100 Subject: [PATCH] feat: removed Component from Blueprint --- .../test/src/components/spaceship_ramp_test.dart | 7 +++++-- packages/pinball_flame/lib/src/blueprint.dart | 11 ++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/pinball_components/test/src/components/spaceship_ramp_test.dart b/packages/pinball_components/test/src/components/spaceship_ramp_test.dart index 98a6e95f..a65ba18b 100644 --- a/packages/pinball_components/test/src/components/spaceship_ramp_test.dart +++ b/packages/pinball_components/test/src/components/spaceship_ramp_test.dart @@ -29,9 +29,12 @@ void main() { 'loads correctly', (game) async { 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); + } }, ); diff --git a/packages/pinball_flame/lib/src/blueprint.dart b/packages/pinball_flame/lib/src/blueprint.dart index cc1d31ae..696adc02 100644 --- a/packages/pinball_flame/lib/src/blueprint.dart +++ b/packages/pinball_flame/lib/src/blueprint.dart @@ -1,16 +1,13 @@ import 'package:flame/components.dart'; import 'package:flame/game.dart'; -// TODO(erickzanardo): Keeping this inside our code base -// so we can experiment with the idea, but this is a -// potential upstream change on Flame. +// TODO(erickzanardo): Keeping this inside our code base so we can experiment +// with the idea, but this is a potential upstream change on Flame. /// {@template blueprint} -/// A [Blueprint] is a virtual way of grouping [Component]s that are related, -/// but they need to be added directly on the [FlameGame] level. +/// A [Blueprint] is a virtual way of grouping [Component]s that are related. /// {@endtemplate blueprint} -// TODO(alestiago): refactor with feat/make-blueprint-extend-component. -class Blueprint extends Component { +class Blueprint { /// {@macro blueprint} Blueprint({ Iterable? components,