use of com.bladecoder.engine.model.AnimationRenderer in project bladecoder-adventure-engine by bladecoder.
the class PickUpAction method run.
@Override
public boolean run(VerbRunner cb) {
Scene scn = this.actor.getScene();
InteractiveActor actor = (InteractiveActor) scn.getActor(this.actor.getActorId(), false);
if (actor == null) {
EngineLogger.error("PickUpAction - Actor not found:" + this.actor.getActorId());
return false;
}
scn.removeActor(actor);
if (actor instanceof SpriteActor) {
SpriteActor a = (SpriteActor) actor;
if (scn != World.getInstance().getCurrentScene() && World.getInstance().getCachedScene(scn.getId()) == null) {
a.loadAssets();
EngineAssetManager.getInstance().finishLoading();
a.retrieveAssets();
}
if (a.getRenderer() instanceof AnimationRenderer) {
if (animation != null)
a.startAnimation(animation, null);
else if (((AnimationRenderer) a.getRenderer()).getAnimations().get(a.getId() + ".inventory") != null)
a.startAnimation(a.getId() + ".inventory", null);
}
World.getInstance().getInventory().addItem(a);
}
return false;
}
use of com.bladecoder.engine.model.AnimationRenderer in project bladecoder-adventure-engine by bladecoder.
the class AnimationAction method run.
@Override
public boolean run(VerbRunner cb) {
// EngineLogger.debug(MessageFormat.format("ANIMATION_ACTION: {0}.{1}", animation.getActorId(), animation.getAnimationId()));
String actorId = animation.getActorId();
SpriteActor a = (SpriteActor) World.getInstance().getCurrentScene().getActor(actorId, true);
String anim = animation.getAnimationId();
if (keepDirection) {
String c = ((AnimationRenderer) a.getRenderer()).getCurrentAnimationId();
if (anim.endsWith(AnimationRenderer.LEFT) && c.endsWith(AnimationRenderer.RIGHT) || anim.endsWith(AnimationRenderer.RIGHT) && c.endsWith(AnimationRenderer.LEFT)) {
anim = AnimationRenderer.getFlipId(anim);
}
}
a.startAnimation(anim, repeat, count, wait ? cb : null);
return wait;
}
Aggregations