Example usage for com.badlogic.gdx.graphics.g3d.particles ParticleEffect init

List of usage examples for com.badlogic.gdx.graphics.g3d.particles ParticleEffect init

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.particles ParticleEffect init.

Prototype

public void init() 

Source Link

Usage

From source file:com.mygdx.game.scene.GameScene.java

License:Apache License

private GameObject spawnFromBlueprint(GameObjectBlueprint bp) {
    if (bp.pfx != null) {
        ParticleEffect originalEffect = assets.getAsset(bp.pfx, ParticleEffect.class);
        // we cannot use the originalEffect, we must make a copy each time we create new particle effect
        ParticleEffect effect = originalEffect.copy();
        particleEffects.add(effect);/*www  .  j ava 2 s  .  c  om*/
        effect.translate(bp.position);
        effect.rotate(Vector3.X, 180);
        effect.init();
        effect.start();
        ParticleSystem particleSystem = ParticleSystem.get();
        particleSystem.add(effect);
        return null;
    }
    if (bp.model != null && bp.shape != null) {

        return spawnGameModelBody(bp, bp.position);

    } else if (bp.model == null && bp.shape != null) {
        InvisibleBody obj = new InvisibleBody(bp.name, bp.shape, bp.mass, bp.position, bp.rotation,
                bp.belongsToFlag, bp.collidesWithFlag, bp.callback, bp.noDeactivate);
        addGameObject(obj);
        return obj;

    } else if (bp.model != null) {
        GameModel obj = new GameModel(bp.model, bp.name, bp.position, bp.rotation, bp.scale);
        obj.visibleOnLayers.clear();
        obj.visibleOnLayers.or(bp.visibleOnLayers);
        addGameObject(obj);
        return obj;
    } else {
        throw new GdxRuntimeException("Could not read blueprint " + bp);
    }
}