BonfireGame constructor
BonfireGame({
- required BuildContext context,
- required GameMap map,
- JoystickController? joystickController,
- Player? player,
- GameInterface? interface,
- List<
Enemy> ? enemies, - List<
GameDecoration> ? decorations, - List<
GameComponent> ? components, - GameBackground? background,
- bool constructionMode = false,
- bool showCollisionArea = false,
- GameController? gameController,
- Color? constructionModeColor,
- Color? collisionAreaColor,
- Color? lightingColorGame,
- ValueChanged<
BonfireGame> ? onReady, - TapInGame? onTapDown,
- TapInGame? onTapUp,
- Color? backgroundColor,
- GameColorFilter? colorFilter,
- 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,
);
}