Search in sources :

Example 1 with BuffAnim

use of eidolons.libgdx.anims.std.BuffAnim in project Eidolons by IDemiurge.

the class AnimMaster method mouseHover.

private void mouseHover(Unit unit) {
    unit.getBuffs().forEach(buff -> {
        BuffAnim anim = continuousAnims.get(buff);
        if (anim != null) {
            anim.reset();
            anim.start();
            anim.setDuration(showBuffAnimsOnHoverLength);
        }
    });
}
Also used : BuffAnim(eidolons.libgdx.anims.std.BuffAnim)

Example 2 with BuffAnim

use of eidolons.libgdx.anims.std.BuffAnim in project Eidolons by IDemiurge.

the class AnimMaster method updateContinuousAnims.

private void updateContinuousAnims() {
    if (!continuousAnimsOn) {
        return;
    }
    final List<BuffObj> toRemove = new ArrayList<>();
    continuousAnims.keySet().forEach(buff -> {
        if (buff.isDead()) {
            continuousAnims.get(buff).finished();
            toRemove.add(buff);
        }
    });
    toRemove.forEach(buff -> {
        continuousAnims.remove(buff);
    });
    DC_Game.game.getUnits().forEach(unit -> {
        unit.getBuffs().forEach(buff -> {
            if (// TODO or full reset always?
            !continuousAnims.containsKey(buff)) {
                if (buff.isVisible()) {
                    BuffAnim anim = constructor.getBuffAnim(buff);
                    // TODO cache!
                    if (anim != null) {
                        continuousAnims.put(buff, anim);
                        try {
                            anim.start();
                        } catch (Exception e) {
                            main.system.ExceptionMaster.printStackTrace(e);
                        }
                    }
                }
            }
        });
    });
}
Also used : BuffAnim(eidolons.libgdx.anims.std.BuffAnim) ArrayList(java.util.ArrayList) BuffObj(main.entity.obj.BuffObj)

Aggregations

BuffAnim (eidolons.libgdx.anims.std.BuffAnim)2 ArrayList (java.util.ArrayList)1 BuffObj (main.entity.obj.BuffObj)1