From a02110ccf456ba250e46eb3186eb637e7754172f Mon Sep 17 00:00:00 2001 From: Allison Ryan Date: Mon, 11 Apr 2022 12:51:35 -0500 Subject: [PATCH] refactor: remove animatronic controller --- lib/game/components/flutter_forest.dart | 26 ++----------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/lib/game/components/flutter_forest.dart b/lib/game/components/flutter_forest.dart index 8874ffa3..76699ec9 100644 --- a/lib/game/components/flutter_forest.dart +++ b/lib/game/components/flutter_forest.dart @@ -37,8 +37,7 @@ class FlutterForest extends Component with Controls<_FlutterForestController> { final smallRightNest = _ControlledSmallDashNestBumper.b( id: 'small_nest_bumper_b', )..initialPosition = Vector2(23.3, 46.75); - final dashAnimatronic = _ControlledDashAnimatronic() - ..position = Vector2(20, -66); + final dashAnimatronic = DashAnimatronic()..position = Vector2(20, -66); await addAll([ signPost, @@ -71,14 +70,10 @@ class _FlutterForestController extends ComponentController void onNewState(GameState state) { super.onNewState(state); - _startDashAnimatronic(); + component.firstChild()?.playing = true; _addBonusBall(); } - void _startDashAnimatronic() { - component.firstChild<_ControlledDashAnimatronic>()?.controller.start(); - } - Future _addBonusBall() async { await Future.delayed(const Duration(milliseconds: 700)); await gameRef.add( @@ -88,23 +83,6 @@ class _FlutterForestController extends ComponentController } } -class _ControlledDashAnimatronic extends DashAnimatronic - with Controls<_DashAnimatronicController> { - _ControlledDashAnimatronic() { - controller = _DashAnimatronicController(this); - } -} - -class _DashAnimatronicController extends ComponentController - with HasGameRef { - _DashAnimatronicController(DashAnimatronic dashAnimatronic) - : super(dashAnimatronic); - - void start() { - component.playing = true; - } -} - class _ControlledBigDashNestBumper extends BigDashNestBumper with Controls, ScorePoints { _ControlledBigDashNestBumper({required String id}) : super() {