BonfireGame constructor

BonfireGame({
  1. required BuildContext context,
  2. required GameMap map,
  3. JoystickController? joystickController,
  4. Player? player,
  5. GameInterface? interface,
  6. List<Enemy>? enemies,
  7. List<GameDecoration>? decorations,
  8. List<GameComponent>? components,
  9. GameBackground? background,
  10. bool constructionMode = false,
  11. bool showCollisionArea = false,
  12. GameController? gameController,
  13. Color? constructionModeColor,
  14. Color? collisionAreaColor,
  15. Color? lightingColorGame,
  16. ValueChanged<BonfireGame>? onReady,
  17. TapInGame? onTapDown,
  18. TapInGame? onTapUp,
  19. Color? backgroundColor,
  20. GameColorFilter? colorFilter,
  21. CameraConfig? cameraConfig,
})

Implementation

BonfireGame({
  required this.context,
  required this.map,
  JoystickController? joystickController,
  this.player,
  this.interface,
  List<Enemy>? enemies,
  List<GameDecoration>? decorations,
  List<GameComponent>? components,
  this.background,
  this.constructionMode = false,
  this.showCollisionArea = false,
  this.gameController,
  this.constructionModeColor,
  this.collisionAreaColor,
  this.lightingColorGame,
  this.onReady,
  this.onTapDown,
  this.onTapUp,
  Color? backgroundColor,
  GameColorFilter? colorFilter,
  CameraConfig? cameraConfig,
})  : _joystickController = joystickController,
      super(camera: BonfireCamera(cameraConfig ?? CameraConfig())) {
  _bgColor = backgroundColor;
  camera.setGame(this);
  camera.target ??= player;

  _addLater.addAll(enemies ?? []);
  _addLater.addAll(decorations ?? []);
  _addLater.addAll(components ?? []);
  _lighting = LightingComponent(
    color: lightingColorGame ?? const Color(0x00000000),
  );
  _colorFilterComponent = ColorFilterComponent(
    colorFilter ?? GameColorFilter(),
  );
  _joystickController?.addObserver(player ?? JoystickMapExplorer(camera));

  debugMode = constructionMode;

  _interval = IntervalTick(
    INTERVAL_UPDATE_CACHE,
    tick: updateVisibleCollisionsMicrotask,
  );
  _intervalUpdateOder = IntervalTick(
    INTERVAL_UPDATE_ORDER,
    tick: updateOrderPriorityMicrotask,
  );
}