コード例 #1
0
  @Override
  public void retrieveAssets() {

    // RETRIEVE BACKGROUND
    if (backgroundAtlas != null && !backgroundAtlas.isEmpty()) {
      background = EngineAssetManager.getInstance().getRegions(backgroundAtlas, backgroundRegionId);

      int width = 0;

      for (int i = 0; i < background.size; i++) {
        width += background.get(i).getRegionWidth();
      }

      int height = background.get(0).getRegionHeight();

      // Sets the scrolling dimensions. It must be done here because
      // the background must be loaded to calculate the bbox
      camera.setScrollingDimensions(width, height);

      // if(followActor != null)
      // camera.updatePos(followActor);
    }

    // RETRIEVE LIGHT MAP
    if (lightMapAtlas != null && !lightMapAtlas.isEmpty()) {
      lightMap = EngineAssetManager.getInstance().getRegions(lightMapAtlas, lightMapRegionId);
    }

    // RETRIEVE ACTORS
    for (BaseActor a : actors.values()) {
      if (a instanceof AssetConsumer) ((AssetConsumer) a).retrieveAssets();
    }

    if (musicFilename != null) {
      music = EngineAssetManager.getInstance().getMusic(musicFilename);
      if (isPlayingSer) { // TODO must be in World???
        if (music != null) {
          music.setPosition(musicPosSer);
          musicPosSer = 0f;
        }

        playMusic();
        isPlayingSer = false;
      }
    }
  }