/**
   * Instantiates a new game impl.
   *
   * @param logger the logger
   * @param imageLoader the image loader
   * @param engine the engine
   * @param fighters the fighters
   * @param availableControllers the available controllers
   * @param collisionDetector the collision detector
   * @param arenaRenderer the arena renderer
   * @param loadingScene the loading scene
   * @param aiControllerParser the ai controller parser
   * @throws Exception the exception
   */
  @Inject
  public SfVsMk2Impl(
      Logger logger,
      Engine engine,
      Map<String, Provider<Fighter>> fighters,
      Set<Controller> availableControllers,
      CollisionDetector collisionDetector,
      ArenaRenderer arenaRenderer,
      Map<String, Provider<Scene>> scenes,
      Map<String, Provider<Arena>> arenas,
      AiControllerParser aiControllerParser,
      ArenaFactory arenaFactory)
      throws Exception {

    this.logger = logger;
    this.engine = engine;
    this.controller = availableControllers.iterator().next();
    this.collisionDetector = collisionDetector;
    this.aiControllerParser = aiControllerParser;
    this.aiController =
        aiControllerParser.parseFromXmlFile("/org/jfge/games/sfvsmk2/ai/sfvsmk2Ai.xml");

    Scene loadingScene = scenes.get("loadingScreen").get();

    engine.addRenderable(loadingScene);
    engine.addUpdatable(loadingScene);
    engine.start();

    fighter1 = fighters.get("liuKang").get();
    fighter2 = fighters.get("ryu").get();

    collisionDetector.addFighter(fighter1);
    collisionDetector.addFighter(fighter2);

    this.arena = arenas.get("sfvsmk2").get();

    arena.setFighterLeft(fighter1);
    arena.setFighterRight(fighter2);
    arena.setFighterLeftController(controller);

    engine.removeRenderable(loadingScene);
    engine.removeUpdatable(loadingScene);

    engine.addRenderable(this);
    engine.addUpdatable(this);
  }
  /* (non-Javadoc)
   * @see org.jfge.engine.Updatable#update()
   */
  @Override
  public void update() {

    //		aiController.handle(fighter2, fighter1);

    fighter1.update();
    fighter2.update();
    collisionDetector.update();
    arena.update();
  }
  /* (non-Javadoc)
   * @see org.jfge.engine.Renderable#render(java.awt.Graphics)
   */
  @Override
  public void render(Graphics graphics) {
    /*
     * draw arena background should be done in renderer
     */
    arena.render(graphics);

    /*
     * render fighters;
     */
    fighter1.render(graphics);
    fighter2.render(graphics);
  }