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; }
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; }
public void release(Particle particle) { if (particle != dummy) { ParticlePool pool = particlesByEmitter.get(particle.getEmitter()); pool.available.add(particle); } }