use of com.badlogic.gdx.scenes.scene2d.actions.ParallelAction in project Eidolons by IDemiurge.
the class AttackAnim method getAction.
/*
delayAction
scale
size - elongate
*/
// TODO back?
@Override
protected Action getAction() {
// if (sequence != null) //reset sometimes?
// return sequence;
sequence = new SequenceAction();
int i = 0;
float totalDuration = 0;
for (ATK_ANIMS anim : anims) {
for (float angle : anim.targetAngles) {
List<Pair<MoveByAction, RotateByAction>> swings = new ArrayList<>();
float duration = this.duration;
if (duration <= 0) {
duration = 1;
}
// anim.durations[i];
totalDuration += duration;
float x = anim.offsetsX[i];
float y = anim.offsetsY[i];
MoveByAction mainMove = null;
try {
mainMove = getMoveAction(x, y, duration);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (mainMove == null) {
return null;
}
RotateByAction mainRotate = getRotateAction(angle, duration);
swings.add(new ImmutablePair<>(mainMove, mainRotate));
swings.forEach(swing -> {
sequence.addAction(new ParallelAction(swing.getKey(), swing.getValue()));
});
i++;
}
}
setDuration(totalDuration);
return sequence;
}
Aggregations