float speed = 1.0f;
if(!anim->is_looping() && d)
speed = (anim->get_duration()/Time::sec)/d;
- if(stacked)
- player->play_stacked(*target, *anim, speed);
+ if(target_obj)
+ {
+ if(stacked)
+ player->play_stacked(*target_obj, *anim, speed);
+ else
+ player->play(*target_obj, *anim, speed);
+ }
else
- player->play(*target, *anim, speed);
+ {
+ if(stacked)
+ player->play_stacked(*target, *anim, speed);
+ else
+ player->play(*target, *anim, speed);
+ }
}
void Animate::Loader::target(const string &n)
{
obj.target = &demo.get_thing<GL::Placeable>(n);
+ obj.target_obj = dynamic_cast<GL::AnimatedObject *>(obj.target);
}
} // namespace DemoScene
#ifndef MSP_DEMOSCENE_ANIMATE_H_
#define MSP_DEMOSCENE_ANIMATE_H_
+#include <msp/gl/animatedobject.h>
#include <msp/gl/animation.h>
#include <msp/gl/animationplayer.h>
#include "action.h"
private:
Msp::GL::Placeable *target;
+ Msp::GL::AnimatedObject *target_obj;
const Msp::GL::Animation *anim;
bool stacked;
Msp::GL::AnimationPlayer *player;