Example character level animations.
This commit is contained in:
@ -15,9 +15,17 @@ AnimationController::AnimationController(SceneItem *item) :
|
||||
|
||||
}
|
||||
|
||||
void AnimationController::addAnimation(Animation *animation) {
|
||||
assertNotNull(animation);
|
||||
this->animations.push_back(animation);
|
||||
}
|
||||
|
||||
void AnimationController::onSceneUpdate() {
|
||||
if(this->animation == nullptr) return;
|
||||
this->animation->tick(this->getGame()->timeManager.delta);
|
||||
auto it = this->animations.begin();
|
||||
while(it != this->animations.end()) {
|
||||
(*it)->tick(this->getGame()->timeManager.delta);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationController::onStart() {
|
||||
|
@ -10,13 +10,14 @@
|
||||
namespace Dawn {
|
||||
class AnimationController : public SceneItemComponent {
|
||||
private:
|
||||
std::vector<Animation*> animations;
|
||||
void onSceneUpdate();
|
||||
|
||||
public:
|
||||
Animation *animation = nullptr;
|
||||
|
||||
AnimationController(SceneItem *item);
|
||||
|
||||
void addAnimation(Animation *animation);
|
||||
|
||||
void onStart() override;
|
||||
void onDispose() override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user