public void setEnabled (ParticleEmitter emitter, boolean enabled) { ParticleData data = particleData.get(emitter); if (data == null) particleData.put(emitter, data = new ParticleData()); data.enabled = enabled; emitter.reset(); }
public void setEnabled (ParticleEmitter emitter, boolean enabled) { ParticleData data = particleData.get(emitter); if (data == null) particleData.put(emitter, data = new ParticleData()); data.enabled = enabled; emitter.reset(); }
/** Resets the effect so it can be started again like a new effect. * @param resetScaling Whether to restore the original size and motion parameters if they were scaled. Repeated scaling * and resetting may introduce error. */ public void reset (boolean resetScaling){ for (int i = 0, n = emitters.size; i < n; i++) emitters.get(i).reset(); if (resetScaling && (xSizeScale != 1f || ySizeScale != 1f || motionScale != 1f)){ scaleEffect(1f / xSizeScale, 1f / ySizeScale, 1f / motionScale); xSizeScale = ySizeScale = motionScale = 1f; } }
/** Resets the effect so it can be started again like a new effect. * @param resetScaling Whether to restore the original size and motion parameters if they were scaled. Repeated scaling * and resetting may introduce error. */ public void reset (boolean resetScaling){ for (int i = 0, n = emitters.size; i < n; i++) emitters.get(i).reset(); if (resetScaling && (xSizeScale != 1f || ySizeScale != 1f || motionScale != 1f)){ scaleEffect(1f / xSizeScale, 1f / ySizeScale, 1f / motionScale); xSizeScale = ySizeScale = motionScale = 1f; } }
public boolean keyDown (int keycode) { ParticleEmitter emitter = emitters.get(emitterIndex); if (keycode == Input.Keys.DPAD_UP) particleCount += 5; else if (keycode == Input.Keys.PLUS) { emitter = new ParticleEmitter(emitter); } else if (keycode == Input.Keys.DPAD_DOWN) particleCount -= 5; else if (keycode == Input.Keys.SPACE) { emitterIndex = (emitterIndex + 1) % emitters.size; emitter = emitters.get(emitterIndex); // if we've previously stopped the emitter reset it if (emitter.isComplete()) emitter.reset(); particleCount = (int)(emitter.getEmission().getHighMax() * emitter.getLife().getHighMax() / 1000f); } else if (keycode == Input.Keys.ENTER) { emitter = emitters.get(emitterIndex); if (emitter.isComplete()) emitter.reset(); else emitter.allowCompletion(); } else return false; particleCount = Math.max(0, particleCount); if (particleCount > emitter.getMaxParticleCount()) emitter.setMaxParticleCount(particleCount * 2); emitter.getEmission().setHigh(particleCount / emitter.getLife().getHighMax() * 1000); effect.getEmitters().clear(); effect.getEmitters().add(emitter); return false; }
public void setEnabled (ParticleEmitter emitter, boolean enabled) { ParticleData data = particleData.get(emitter); if (data == null) particleData.put(emitter, data = new ParticleData()); data.enabled = enabled; emitter.reset(); }
/** Resets the effect so it can be started again like a new effect. * @param resetScaling Whether to restore the original size and motion parameters if they were scaled. Repeated scaling * and resetting may introduce error. */ public void reset (boolean resetScaling){ for (int i = 0, n = emitters.size; i < n; i++) emitters.get(i).reset(); if (resetScaling && (xSizeScale != 1f || ySizeScale != 1f || motionScale != 1f)){ scaleEffect(1f / xSizeScale, 1f / ySizeScale, 1f / motionScale); xSizeScale = ySizeScale = motionScale = 1f; } }