本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.ParticleEffect.setDuration方法的典型用法代碼示例。如果您正苦於以下問題:Java ParticleEffect.setDuration方法的具體用法?Java ParticleEffect.setDuration怎麽用?Java ParticleEffect.setDuration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.setDuration方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: resetFireworksEffect
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
/**
* Resets the position, start color and duration of the given firework effects to random values.
*
* @param effect
*/
private void resetFireworksEffect(ParticleEffect effect) {
effect.reset();
effect.setDuration(Utils.randomWithin(180, 250));
effect.setPosition(Utils.randomWithin(0, WINDOW_WIDTH), Utils.randomWithin(0, WINDOW_HEIGHT));
float[] colors = effect.getEmitters().get(0).getTint().getColors();
int randomStartColor = Utils.randomWithin(0, startColors.length - 1);
for (int i = 0; i < 6; i++) {
colors[i] = startColors[randomStartColor][i % 3];
}
for (ParticleEmitter emitter : effect.getEmitters()) {
emitter.getTint().setColors(colors);
}
}
示例2: Fireball
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public Fireball(World world, float x, float y, float width) {
super(null, new CircleShape(), world, x, y, width);
this.lifeSpan = 3000;
effect = new ParticleEffect();
effect.load(Gdx.files.internal("fire.p"), Assets.getAtlas());
effect.scaleEffect(width);
effect.setDuration((int) (lifeSpan - 1000));
effect.start();
}
示例3: ParticleStatus
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public ParticleStatus(Actor owner, long time, String name, ParticleEffect particleEffect) {
super(owner, time, name);
this.particleEffect = particleEffect;
particleEffect.setDuration((int) time - 1000);
particleEffect.scaleEffect(owner.getWidth() * owner.getHeight() / 4);
particleEffect.start();
}
示例4: resetFireworksEffect
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
/**
* Resets the position, start color and duration of the given firework effects to random values.
*
* @param effect
*/
private void resetFireworksEffect(ParticleEffect effect) {
effect.reset();
effect.setDuration(Utils.randomWithin(180, 250));
// effect.setPosition(Utils.randomWithin(0, WINDOW_WIDTH), Utils.randomWithin(0, WINDOW_HEIGHT));
}
示例5: onRemoveColor
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
public void onRemoveColor(Monster monster, MonsterColor color) {
ParticleEffect effect = effects.get(color);
if (effect != null) {
effect.setDuration(0);
}
}