Search in sources :

Example 11 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class LightLayer method adjust.

private void adjust(LightContainer container) {
    float scaleRange = container.lightLayer.scaleRange;
    container.getContent().setScale(RandomWizard.getRandomFloatBetween(1 + scaleRange / 2, 1 + scaleRange));
    container.setVisible(true);
    addActor(container);
    Boolean flipX = null;
    float y, x = 0;
    if (container.lightLayer.vertical) {
        x = getWidth() / 3 + RandomWizard.getRandomInt((int) getWidth() / 3) - container.getWidth() / 2;
        y = getHeight() - RandomWizard.getRandomFloatBetween(100, container.getContent().getScaleY() * container.getHeight() - 100);
        flipX = RandomWizard.random();
    } else {
        flipX = time == DAY_TIME.DUSK;
        if (time == DAY_TIME.MIDDAY) {
            flipX = RandomWizard.random();
        }
        x = flipX ? -container.getWidth() / 3 - RandomWizard.getRandomInt((int) container.getWidth() / 3) : getWidth() - container.getWidth() / 2.25f - RandomWizard.getRandomInt((int) (container.getWidth() / 2));
        y = RandomWizard.getRandomInt((int) getHeight());
    }
    container.setFlipX(flipX);
    container.setPosition(x, y);
    if (container.lightLayer.emitterPaths != null) {
        for (String sub : container.lightLayer.emitterPaths) {
            EmitterActor emitter = new EmitterActor(sub);
            container.addActor(emitter);
            emitter.setPosition(container.getWidth() / 2, GdxMaster.getHeight() - 25);
            emitter.setSpeed(0.5f);
            emitter.start();
            emitter.getEffect().getEmitters().get(0).scaleSize(container.getScaleX() + 0.25f);
        }
        container.getContent().setZIndex(0);
    }
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 12 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class MapParticles method create.

private EmitterActor create(String path, int x, int y, DAY_TIME time) {
    // new EmitterActor(sfx.sfxPath);
    EmitterActor actor = EmitterPools.getEmitterActor(path);
    actor.setPosition(x, y);
    actor.setSpeed(getSpeed(path));
    actor.setFlipX(isFlipX(path, MacroGame.getGame().getWindDirection()));
    actor.setFlipY(isFlipY(path, MacroGame.getGame().getWindDirection()));
    MapMaster.addToListMap(map, time, actor);
    return actor;
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 13 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class Anim method getTimeToFinish.

private float getTimeToFinish() {
    float time = 0;
    for (EmitterActor e : emitterList) {
        for (ParticleEmitter emitter : e.getEffect().getEmitters()) {
            float timeLeft = emitter.getDuration().getLowMax() / 1000 * Math.max(0, emitter.getPercentComplete());
            if (timeLeft > time) {
                time = timeLeft;
            }
        }
    }
    float gracePeriod = 0.25f;
    time = time + time * gracePeriod;
    LogMaster.log(LogMaster.ANIM_DEBUG, this + " adding TimeToFinish: " + time);
    return time;
}
Also used : ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 14 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class AnimMultiplicator method applyMultiplicationForCoordinates.

public void applyMultiplicationForCoordinates(Set<Coordinates> coordinates) {
    List<EmitterActor> list = new ArrayList<>();
    filterCoordinates(template, coordinates).forEach(c -> {
        for (EmitterActor e : emitterList) {
            if (e.isGenerated()) {
                continue;
            }
            EmitterActor actor = multiplicateEmitter(null, c, e);
            list.add(actor);
        }
    });
    list.forEach(a -> emitterList.add(a));
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 15 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class AnimMultiplicator method multiplicateEmitter.

private EmitterActor multiplicateEmitter(Integer angle, Coordinates c, EmitterActor e) {
    EmitterActor actor = EmitterPools.getEmitterActor(e.path);
    actor.setPosition(getX(), getY());
    actor.setAttached(false);
    actor.setGenerated(true);
    ActorMaster.addRemoveAfter(actor);
    anim.getMaster().addActor(actor);
    if (angle != null) {
        createAndAddEmitterActions(actor, angle, template);
    } else {
        createAndAddEmitterActions(actor, c);
    }
    return actor;
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Aggregations

EmitterActor (eidolons.libgdx.anims.particles.EmitterActor)17 Vector2 (com.badlogic.gdx.math.Vector2)3 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 DAY_TIME (main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)2 Coordinates (main.game.bf.Coordinates)2 Batch (com.badlogic.gdx.graphics.g2d.Batch)1 ParticleEmitter (com.badlogic.gdx.graphics.g2d.ParticleEmitter)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 CompositeAnim (eidolons.libgdx.anims.CompositeAnim)1 EMITTER_VALUE_GROUP (eidolons.libgdx.anims.particles.EmitterPresetMaster.EMITTER_VALUE_GROUP)1 MAP_POINTS (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS)1 ActiveObj (main.entity.obj.ActiveObj)1 FileChooser (main.swing.generic.components.editors.FileChooser)1 DequeImpl (main.system.datatypes.DequeImpl)1