Пример #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;
  }