Add support for finishing Animation when it encounters obstacle or finishes its path
This commit is contained in:
@@ -24,11 +24,13 @@ public interface Animation extends Placeable, Movable, Renderable, Updatable {
|
||||
|
||||
void setRepeat(Integer repeat);
|
||||
|
||||
void followPath(Path<Animation> path, boolean repeat);
|
||||
void followPath(Path<Animation> path, Integer repeat, boolean finishOnEnd, boolean finishOnFail);
|
||||
|
||||
void setSpeed(float speed);
|
||||
|
||||
void onAdd(Layer layer);
|
||||
|
||||
void finish();
|
||||
|
||||
boolean finished();
|
||||
}
|
||||
|
||||
@@ -160,8 +160,8 @@ public abstract class AnimationDelegate implements Animation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void followPath(Path<Animation> path, boolean repeat) {
|
||||
animation.followPath(path, repeat);
|
||||
public void followPath(Path<Animation> path, Integer repeat, boolean finishOnEnd, boolean finishOnFail) {
|
||||
animation.followPath(path, repeat, finishOnEnd, finishOnFail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,6 +174,11 @@ public abstract class AnimationDelegate implements Animation {
|
||||
animation.onAdd(layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
animation.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Screen screen, Camera camera, ShaderManager shaderManager) {
|
||||
animation.render(screen, camera, shaderManager);
|
||||
|
||||
Reference in New Issue
Block a user