use of eidolons.libgdx.anims.sprite.SpriteAnimation in project Eidolons by IDemiurge.
the class AnimMaster3d method getSpriteForAction.
public static SpriteAnimation getSpriteForAction(float duration, DC_ActiveObj activeObj, Obj targetObj, WEAPON_ANIM_CASE aCase, Boolean projection) {
// loops,
// TODO who is displayed above on the cell?
// modify texture? coloring, sizing,
// float angle = PositionMaster.getAngle(activeObj.getOwnerObj(), targetObj);
// float baseAngle =
// float rotation = angle * 2 / 3;
String name = getAtlasFileKeyForAction(projection, activeObj, aCase);
TextureAtlas atlas = getAtlas(activeObj, aCase);
Array<AtlasRegion> regions = atlas.findRegions(name.toLowerCase());
if (regions.size == 0) {
if (isSearchAtlasRegions(activeObj))
regions = findAtlasRegions(atlas, projection, activeObj, true);
}
if (regions.size == 0) {
if (activeObj.getParentAction() != null)
if (isSearchAtlasRegions(activeObj))
regions = findAtlasRegions(atlas, projection, activeObj, false);
}
if (regions.size == 0)
main.system.auxiliary.log.LogMaster.log(1, activeObj + ": " + aCase + " no 3d sprites: " + name + atlas);
// if (TexturePackerLaunch.TRIM) {
// regions.forEach(region -> {
// region.setRegionHeight(getHeight(activeObj));
// region.setRegionWidth(getWidth(activeObj));
// region.setRegionWidth(region.originalWidth);
// region.setRegionHeight(region.originalHeight);
// });
// }
float frameDuration = duration / regions.size;
int loops = 0;
if (aCase.isMissile()) {
// loops = Math.max(0,PositionMaster.getDistance(activeObj.getOwnerObj(), targetObj) - 1);
}
if (loops != 0)
frameDuration /= loops;
SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(regions, frameDuration, loops);
// sprite.setRotation(rotation);
return sprite;
}
use of eidolons.libgdx.anims.sprite.SpriteAnimation in project Eidolons by IDemiurge.
the class BuffAnim method setSprites.
@Override
public void setSprites(List<SpriteAnimation> sprites) {
super.setSprites(sprites);
lifecycleDuration = 0;
for (SpriteAnimation s : getSprites()) {
if (s.getLifecycleDuration() > lifecycleDuration) {
lifecycleDuration = s.getLifecycleDuration();
}
}
}
use of eidolons.libgdx.anims.sprite.SpriteAnimation in project Eidolons by IDemiurge.
the class HitAnim method resetSprites.
@Override
protected void resetSprites() {
sprites.clear();
spriteType = getSpriteType((BattleFieldObject) getRef().getTargetObj());
hitType = getHitType(getActive(), spriteType);
String spritePath = StrPathBuilder.build(getHitSpritesPath(), spriteType.name(), hitType.spritePath) + ".txt";
// + ".png";
// SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(spritePath);
// scale?
SmartTextureAtlas atlas = SmartTextureAtlas.getAtlas(PathFinder.getImagePath() + spritePath);
if (atlas == null)
return;
Array<AtlasRegion> regions = atlas.getRegions();
SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(regions, getDuration() / regions.size, 1);
if (getRef().getTargetObj() instanceof Unit)
sprite.setColor(getColorForSprite((Unit) getRef().getTargetObj()));
sprites.add(sprite);
}
Aggregations