Yes, this is one way of doing it. So for each and every action, I create a groovy script and hard code in it.
I want to design it in a way that I can create/chain these tweens from an editor gui and save them. Is this possible ? And any reason why I should not do this ?
Edit:
taking that sound example, I can have something like this
public abstract class AbstractTween implements Tween {
public abstract void init(Spatial spatial, AppStateManager manager) ;
}
public class SoundTween extends AbstractTween {
private String audioNodeName;
private transient Spatial spatial; // not going to to serialize this
private transient SoundState soundState; // not going to to serialize this
public SoundTween (String audioNodeName){
this.audioNodeName = audioNodeName;
}
public void init (Spatial spatial, AppStateManager manager) {
this.spatial = spatial;
this.soundState = manager.getState(SoundState.class);
}
protected boolean interpolate( double t ) {
soundState.playSound(audioNodeName, spatial);
return true;
}
}
and then it will be possible to save the tween with gson and editor friendly I believe.
Any thoughts ?