Ejemplo n.º 1
0
public class ParticleEffectLogic extends MoveableGameObjectLogic {

  private ParticleManager particleManager = ParticleManager.getInstance();

  private ParticleEffect effect;

  private Assets.ParticleEffects type;

  private Matrix4 trans = new Matrix4();

  public ParticleEffectLogic(Assets.ParticleEffects effect) {
    this.type = effect;
  }

  @Override
  protected void onUpdate(GameObject object, Vector3 offset, float delta) {
    if (effect == null) {
      effect = particleManager.create(object.getPosition(), type);
    }
    trans.set(offset.add(object.getPosition()), object.getOrientation());
    effect.setTransform(trans);
  }

  @Override
  protected void onRemove(GameObject target) {
    particleManager.remove(effect);
  }
}
Ejemplo n.º 2
0
 @Override
 protected void onUpdate(GameObject object, Vector3 offset, float delta) {
   if (effect == null) {
     effect = particleManager.create(object.getPosition(), type);
   }
   trans.set(offset.add(object.getPosition()), object.getOrientation());
   effect.setTransform(trans);
 }
Ejemplo n.º 3
0
 @Override
 protected void onRemove(GameObject target) {
   particleManager.remove(effect);
 }