initGame method

void initGame(
  1. FlameGame<World> game
)

This method is called every time a new game is set in the service and it is responsible for calling the DevToolsConnector.initGame method in all the connectors. It is also responsible for calling DevToolsConnector.disposeGame of all connectors when a new game is set, if there was a game set previously.

Implementation

void initGame(FlameGame game) {
  if (_game != null) {
    for (final connector in connectors) {
      connector.disposeGame();
    }
  }

  _game = game;
  for (final connector in connectors) {
    connector.initGame(game);
  }
}