addJoystickObserver method
void
addJoystickObserver(
- GameComponent target, {
- bool cleanObservers = false,
- bool moveCameraToTarget = false,
override
Use this method to change default observer of the Joystick events.
Implementation
@override
void addJoystickObserver(
GameComponent target, {
bool cleanObservers = false,
bool moveCameraToTarget = false,
}) {
if (target is JoystickListener) {
if (cleanObservers) {
_joystickController?.cleanObservers();
}
_joystickController?.addObserver(target as JoystickListener);
if (moveCameraToTarget) {
camera.moveToTargetAnimated(target);
}
} else {
print('$target is not a JoystickListener');
}
}