mirror of https://github.com/flutter/pinball.git
refactor: AndroidSpaceshipBonusBehavior use FlameBlocListener (#371)
parent
8d4b031350
commit
75527d1fe1
@ -1,14 +1,18 @@
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
import 'package:flame_bloc/flame_bloc.dart';
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:pinball_flame/pinball_flame.dart';
|
||||
|
||||
class AndroidSpaceshipEntranceBallContactBehavior
|
||||
extends ContactBehavior<AndroidSpaceshipEntrance> {
|
||||
extends ContactBehavior<AndroidSpaceshipEntrance>
|
||||
with FlameBlocReader<AndroidSpaceshipCubit, AndroidSpaceshipState> {
|
||||
@override
|
||||
void beginContact(Object other, Contact contact) {
|
||||
super.beginContact(other, contact);
|
||||
if (other is! Ball) return;
|
||||
|
||||
parent.parent.bloc.onBallEntered();
|
||||
bloc.onBallEntered();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue