Exemplo n.º 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;
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void dispose() {

    if (backgroundAtlas != null && !backgroundAtlas.isEmpty()) {
      EngineAssetManager.getInstance().disposeAtlas(backgroundAtlas);
    }

    // LOAD LIGHT MAP
    if (lightMapAtlas != null && !lightMapAtlas.isEmpty()) {
      EngineAssetManager.getInstance().disposeAtlas(lightMapAtlas);
    }

    // orderedActors.clear();

    for (BaseActor a : actors.values()) {
      if (a instanceof AssetConsumer) ((AssetConsumer) a).dispose();
    }

    if (musicFilename != null && music != null) {
      EngineAssetManager.getInstance().disposeMusic(musicFilename);
      music = null;
    }
  }
Exemplo n.º 3
0
  @Override
  public void loadAssets() {

    if (backgroundAtlas != null && !backgroundAtlas.isEmpty()) {
      EngineAssetManager.getInstance().loadAtlas(backgroundAtlas);
    }

    // LOAD LIGHT MAP
    if (lightMapAtlas != null && !lightMapAtlas.isEmpty()) {
      EngineAssetManager.getInstance().loadAtlas(lightMapAtlas);
    }

    if (musicFilename != null) EngineAssetManager.getInstance().loadMusic(musicFilename);

    for (BaseActor a : actors.values()) {
      if (a instanceof AssetConsumer) ((AssetConsumer) a).loadAssets();
    }

    // CALC WALK GRAPH
    if (polygonalNavGraph != null) {
      polygonalNavGraph.createInitialGraph(actors.values());
    }
  }