BonfireGame constructor

BonfireGame({
  1. required BuildContext context,
  2. required MapGame 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. bool showFPS = false,
  17. ValueChanged<BonfireGame>? onReady,
  18. TapInGame? onTapDown,
  19. TapInGame? onTapUp,
  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.showFPS = false,
  this.onReady,
  this.onTapDown,
  this.onTapUp,
  GameColorFilter? colorFilter,
  CameraConfig? cameraConfig,
})  : _joystickController = joystickController,
      super(camera: BonfireCamera(cameraConfig ?? CameraConfig())) {
  _initialEnemies = enemies;
  _initialDecorations = decorations;
  _initialComponents = components;
  _colorFilter = colorFilter ?? GameColorFilter();
  debugMode = constructionMode;

  camera.setGame(this);
  camera.target ??= player;

  _interval = IntervalTick(
    INTERVAL_UPDATE_CACHE,
    tick: _updateTempList,
  );
  _intervalUpdateOder = IntervalTick(
    INTERVAL_UPDATE_ORDER,
    tick: updateOrderPriority,
  );
  _intervalAllCollisions = IntervalTick(
    INTERVAL_UPDATE_COLLISIONS,
    tick: () => scheduleMicrotask(_updateAllCollisions),
  );
}