private void loadAllAssets() {
    logger.debug("Loading All Assets");

    loadEntities();
    loadWeapons();
    for (String s : manifest.images) {
      logger.debug("Image: " + s);
      assetManager.load(s, Texture.class);
    }
    for (String s : manifest.textures) {
      assetManager.load(s, TextureAtlas.class);
    }
    for (String s : manifest.particles) {
      assetManager.load(s, ParticleEffect.class);
    }

    logger.debug("AssetManager begin loading...");
    try {
      while (assetManager.update() == false) {
        drawProgress();
        // logger.debug("  " + (int)(assetManager.getProgress()*100) + "% complete");
      }
    } catch (Exception e) {
      logger.error("Some assets failed to load: " + e.getMessage());
    }
  }
 private void loadAllAssetsInPath(String folder, Class type, String suffix) {
   logger.debug("Loading '" + folder + "'");
   for (FileHandle f : getAssetsPath(folder).list()) {
     String msg = "  Found: " + f.name();
     if (suffix == null) {
       assetManager.load(folder + "/" + f.name(), type);
     } else if (f.name().toLowerCase().endsWith(suffix))
       assetManager.load(folder + "/" + f.name(), type);
     else msg += " ...ignoring";
     logger.debug(msg);
   }
 }
 // Json read
 @Override
 public void read(Json json, JsonValue jsonData) {
   logger.debug("Deserializing");
   PhysicsConfig config = json.fromJson(PhysicsConfig.class, jsonData.toString());
   collisionEffect = config.collisionEffect;
   this.buildFromModel(config.sceneModel);
 }
 // Create everything from a SceneModel. (SceneModels are easily serialized)
 private void buildFromModel(PhysicsSceneModel physicsModel) {
   logger.debug("Build from physics scene model");
   scene.createFromModel(physicsModel);
   for (Body b : scene.getBodies()) {
     b.setUserData(this);
   }
 }
 // Json Write
 @Override
 public void write(Json json) {
   logger.debug("Serializing..");
   PhysicsConfig config = new PhysicsConfig();
   config.collisionEffect = collisionEffect;
   config.sceneModel = scene.toSceneModel();
   json.writeFields(config);
 }
 private void loadWeapons() {
   logger.debug("Loading Weapons");
   Json json = new Json();
   for (String s : manifest.weapons) {
     try {
       WeaponConfig config = json.fromJson(WeaponConfig.class, Gdx.files.internal(s));
       weaponConfigs.put(config.name, config);
     } catch (SerializationException ex) {
       logger.error("Failed to load weapons file: " + s);
       logger.error(ex.getMessage());
     }
   }
 }
  private void loadEntities() {
    logger.debug("Loading Entities");

    Json json = new Json();
    for (String s : manifest.entities) {
      try {
        EntityConfig config = json.fromJson(EntityConfig.class, Gdx.files.internal(s));
        entityConfigs.put(config.name, config);
      } catch (SerializationException ex) {
        logger.error("Failed to load entity file: " + s);
        logger.error(ex.getMessage());
      }
    }
  }
 public Assets() {
   logger.debug("Initializing");
   loadManifest();
   loadAllAssets();
 }
 public String addJoint(JointModel jm) {
   logger.debug("Add joint model");
   logger.error("addJoint(JointModel jm) may not function correctly");
   scene.createJoint(jm);
   return jm.name;
 }
 // Create and add body using a BodyModel. A unique name is automatically generated and returned
 public String addBody(BodyModel bm) {
   logger.debug("Add body model");
   Body b = scene.createBody(bm);
   b.setUserData(this);
   return bm.name;
 }
 // Add Existing body
 public String addBody(Body b) {
   logger.debug("Add body");
   b.setUserData(this);
   return scene.addBody(b);
 }
 // Destroy Joint
 public void destroyJoint(String name) {
   logger.debug("Destroy Joint: " + name);
   scene.destroyJoint(name);
 }
 // Destroy specific fixture
 public void destroyFixture(String name) {
   logger.debug("Destroy fixture: " + name);
   scene.destroyFixture(name);
 }
 // Destroy specific body
 public void destroyBody(String name) {
   logger.debug("Destroy body: " + name);
   scene.destroyBody(name);
 }
 // Destroy everything
 public void destroy() {
   logger.debug("Destroy Everything");
   scene.destroy();
   collisionNormal = 0;
 }