Example usage for com.badlogic.gdx.graphics.g2d ParticleEmitter isComplete

List of usage examples for com.badlogic.gdx.graphics.g2d ParticleEmitter isComplete

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d ParticleEmitter isComplete.

Prototype

public boolean isComplete() 

Source Link

Usage

From source file:com.westernarc.easterrun.gdx.graphics.g2d.ParticleEffect.java

License:Apache License

public boolean isComplete() {
    for (int i = 0, n = emitters.size; i < n; i++) {
        ParticleEmitter emitter = emitters.get(i);
        if (emitter.isContinuous())
            return false;
        if (!emitter.isComplete())
            return false;
    }/*from www.ja v  a2  s  .  co  m*/
    return true;
}

From source file:de.hochschuletrier.gdw.ss15.game.systems.GoalEffectRenderSystem.java

@Override
protected void processEntity(Entity entity, float deltaTime) {
    GoalEffectComponent component = ComponentMappers.goalEffect.get(entity);
    PositionComponent pos = ComponentMappers.position.get(entity);
    TeamComponent team = ComponentMappers.team.get(entity);

    if (team.team != this.teamScored)
        return; //emitter belongs to goal of team who scored

    if (!component.started && !this.goalScored)
        return; //no gool scored and nothing to update

    if (component.started && this.goalScored)
        this.goalScored = false; //all emitters have started

    for (ParticleEmitter emitter : component.effect.getEmitters()) {
        if (!emitter.getName().toLowerCase().equals(this.teamScored.name().toLowerCase())) {
            //gool scored but emitter not started
            if (!component.started) {
                emitter.setPosition(pos.x, pos.y);
                emitter.reset();//w  ww .  ja v  a 2 s  . c  om
                emitter.start();
                component.started = true;
            }
            emitter.update(deltaTime);
            emitter.draw(DrawUtil.batch);
            //System.out.println(emitter.getPercentComplete());
            if (emitter.isComplete()) {
                component.started = false;
            }
        }
    }
}