refactor: connect rampsensors with android acres bonus

pull/296/head
RuiAlonso 3 years ago
parent a154878465
commit 3036cc54de

@ -30,7 +30,13 @@ class RampBonusBehavior extends Component
void onMount() { void onMount() {
super.onMount(); super.onMount();
final sensors = parent.children.whereType<RampSensor>(); final sensors = parent
.descendants()
.whereType<SpaceshipRamp>()
.first
.descendants()
.whereType<RampSensor>();
for (final sensor in sensors) { for (final sensor in sensors) {
sensor.bloc.stream.listen((state) { sensor.bloc.stream.listen((state) {
switch (state.type) { switch (state.type) {

@ -29,7 +29,13 @@ class RampShotBehavior extends Component
void onMount() { void onMount() {
super.onMount(); super.onMount();
final sensors = parent.children.whereType<RampSensor>(); final sensors = parent
.descendants()
.whereType<SpaceshipRamp>()
.first
.descendants()
.whereType<RampSensor>();
for (final sensor in sensors) { for (final sensor in sensors) {
sensor.bloc.stream.listen((state) { sensor.bloc.stream.listen((state) {
switch (state.type) { switch (state.type) {
@ -58,7 +64,7 @@ class RampShotBehavior extends Component
} }
void _shot() { void _shot() {
parent.spaceshipRamp.progress(); parent.descendants().whereType<SpaceshipRamp>().first.progress();
gameRef.read<GameBloc>() gameRef.read<GameBloc>()
..add(const MultiplierIncreased()) ..add(const MultiplierIncreased())

Loading…
Cancel
Save