addJoystickObserver method
void
addJoystickObserver(
- PlayerControllerListener target, {
- bool cleanObservers = false,
- bool moveCameraToTarget = false,
override
Use this method to change default observer of the Joystick events.
Implementation
@override
void addJoystickObserver(
PlayerControllerListener target, {
bool cleanObservers = false,
bool moveCameraToTarget = false,
}) {
if (cleanObservers) {
playerControllers?.forEach(
(c) => c.cleanObservers(),
);
}
playerControllers?.forEach(
(c) => c.addObserver(target),
);
if (moveCameraToTarget && target is GameComponent) {
camera.follow(target as GameComponent);
}
}