addJoystickObserver method

  1. @override
void addJoystickObserver(
  1. JoystickListener target, {
  2. bool cleanObservers = false,
  3. bool moveCameraToTarget = false,
})
override

Use this method to change default observer of the Joystick events.

Implementation

@override
void addJoystickObserver(
  JoystickListener target, {
  bool cleanObservers = false,
  bool moveCameraToTarget = false,
}) {
  if (cleanObservers) {
    _joystickController?.cleanObservers();
  }
  _joystickController?.addObserver(target);
  if (moveCameraToTarget && target is GameComponent) {
    camera.moveToTargetAnimated(target as GameComponent);
  }
}