本文整理汇总了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);
}
}