Search in sources :

Example 6 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class LightLayer method act.

@Override
public void act(float delta) {
    super.act(delta);
    for (LIGHT_LAYER sub : LIGHT_LAYER.values()) {
        MapMaster.addToFloatMap(timerMap, sub, delta);
        for (DAY_TIME day_time : sub.times) {
            if (time != day_time) {
                continue;
            }
            if (triggerMap.get(sub) == null || timerMap.get(sub) > triggerMap.get(sub)) {
                addLight(sub);
                float willSpawnOn = RandomWizard.getRandomFloatBetween(sub.delay, 2 * sub.delay);
                triggerMap.put(sub, willSpawnOn);
                timerMap.put(sub, 0f);
            }
        }
    }
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)

Example 7 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class MapAlphaLayers method init.

public void init() {
    for (File subdir : FileManager.getFilesFromDirectory(getMainPath(), true)) {
        MAP_LAYER_TYPE type = new EnumMaster<MAP_LAYER_TYPE>().retrieveEnumConst(MAP_LAYER_TYPE.class, subdir.getName().toUpperCase());
        if (type != null)
            if (subdir.isDirectory())
                for (File img : subdir.listFiles()) // FileManager.getFilesFromDirectory(subdir.getPath(), true)
                {
                    if (!FileManager.isImageFile(img.getName()))
                        continue;
                    String path = img.getPath();
                    try {
                        path = StringMaster.removePreviousPathSegments(img.getPath(), PathFinder.getImagePath());
                    } catch (Exception e) {
                        main.system.ExceptionMaster.printStackTrace(e);
                    }
                    Image image = new Image(TextureCache.getOrCreateR(path));
                    ImageContainer container = new ImageContainer(image);
                    container.setFluctuateAlpha(true);
                    container.setFluctuatingAlpha(RandomWizard.getRandomFloatBetween(type.alphaMin, type.alphaMax));
                    container.setFluctuatingAlphaPauseDuration(type.pauseAtZero);
                    container.setFluctuatingFullAlphaDuration(type.pauseAtFull);
                    container.setFluctuatingAlphaMin(type.alphaMin);
                    container.setFluctuatingAlphaMax(type.alphaMax);
                    container.setAlphaStep(type.alphaStep);
                    container.setFluctuatingAlphaRandomness(type.randomness);
                    if (img.getName().split("_").length < 2)
                        continue;
                    Coordinates c = new Coordinates(true, img.getName().split("_")[1]);
                    container.setPosition(c.x, MapScreen.defaultSize - c.y);
                    for (DAY_TIME sub : type.times) MapMaster.addToListMap(map, sub, container);
                }
    }
    initialized = true;
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) Coordinates(main.game.bf.Coordinates) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) File(java.io.File) ImageContainer(eidolons.libgdx.bf.generic.ImageContainer)

Example 8 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class MapMoveLayers method spawn.

private void spawn(MAP_MOVING_LAYER sub) {
    MAP_AREA mapArea = null;
    if (sub.spawnAreas == null || sub.spawnAreas.length == 0) {
    // mapArea = MAP_AREA.values()[RandomWizard.getRandomInt(MAP_AREA.values().length)];
    } else
        mapArea = sub.spawnAreas[RandomWizard.getRandomInt(sub.spawnAreas.length)];
    if (mapArea != null) {
        mapArea = flipMapAreaOnWind(mapArea);
    }
    // area , number
    MapMoveLayer container = new MapMoveLayer(sub.getTexturePath(), mapArea, sub) {

        @Override
        protected float getAlphaFluctuationMin() {
            return 0f;
        }
    };
    // cache!
    container.setDirectionModX(getModX(sub.direction) + getModX(sub.direction) * (RandomWizard.getRandomFloatBetween(-sub.randomness, sub.randomness)));
    container.setDirectionModY(getModY(sub.direction) + getModY(sub.direction) * (RandomWizard.getRandomFloatBetween(-sub.randomness, sub.randomness)));
    if (sub.rotation != 0) {
        container.setRotation(RandomWizard.getRandomInt(360));
    }
    container.setMaxDistance(getMaxDistance(mapArea, sub));
    container.setShakiness(sub.shakiness);
    container.setSpeed(sub.speed);
    if (sub.alphaTemplate != null)
        container.setAlphaTemplate(sub.alphaTemplate);
    else if ((sub.alphaStep > 0)) {
        container.setFluctuateAlpha(true);
        container.setFluctuatingAlphaRandomness(0.2f);
        container.setFluctuatingFullAlphaDuration(2.5f);
        container.setFluctuatingAlphaRandomness(sub.alphaRandomness);
        container.setFluctuatingAlphaPauseDuration(sub.pauseDuration);
        container.setFluctuatingFullAlphaDuration(sub.fullAlphaDuration);
        container.setAlphaStep(sub.alphaStep);
    }
    if (sub.maxDuration != null) {
        ActorMaster.addFadeInAndOutAction(container, sub.maxDuration, true);
    }
    for (DAY_TIME day_time : sub.times) {
        map.get(day_time).add(container);
    }
    if (sub.areaGroup != null) {
        if (RandomWizard.random())
            spawn(container, sub.areaGroup);
        return;
    }
    spawn(container, mapArea);
// alpha should reduce as it goes away
// container.setFluctuateAlpha(true);
// container.setFluctuatingAlpha(0);
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)

Aggregations

DAY_TIME (main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)8 EmitterActor (eidolons.libgdx.anims.particles.EmitterActor)3 Vector2 (com.badlogic.gdx.math.Vector2)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 ImageContainer (eidolons.libgdx.bf.generic.ImageContainer)1 LightContainer (eidolons.libgdx.screens.map.layers.LightLayer.LightContainer)1 MAP_MOVING_LAYER (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_MOVING_LAYER)1 MAP_POINTS (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS)1 File (java.io.File)1 Coordinates (main.game.bf.Coordinates)1