Example character level animations.

This commit is contained in:
2023-01-18 23:53:39 -08:00
parent 821074dfc4
commit 985218b9bc
29 changed files with 388 additions and 44 deletions

View File

@ -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() {

View File

@ -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;
};