Пример #1
0
  protected boolean addParticle(final Particle particle) {
    if (particle.getEmitter() != this) {
      nNumParticles++;

      // register listeners
      particle.setEmitter(this);

      // add particle to the same parent
      if (mParent != null) {
        mParent.addChild(particle);
      }
      return true;
    }

    return false;
  }
Пример #2
0
  protected boolean removeParticle(final Particle particle) {
    if (particle.getEmitter() == this) {
      nNumParticles--;

      // remove listener
      particle.setEmitter(null);

      // remove particle from parent
      if (mParent != null) {
        mParent.removeChild(particle);
      }

      // done?
      if (nNumParticles == 0) {
        finish();
      }

      return true;
    }

    return false;
  }
Пример #3
0
 public void release(Particle particle) {
   if (particle != dummy) {
     ParticlePool pool = particlesByEmitter.get(particle.getEmitter());
     pool.available.add(particle);
   }
 }