adding AnimationsSystem.cpp

This commit is contained in:
Clément Le Bihan
2021-06-01 17:26:01 +02:00
parent e298ce03eb
commit b4d783d6c2
9 changed files with 149 additions and 53 deletions
@@ -0,0 +1,27 @@
//
// Created by cbihan on 01/06/2021.
//
#include "AnimationsSystem.hpp"
#include "Component/Animation/AnimationsComponent.hpp"
#include "Model/Model.hpp"
#include "Component/Renderer/Drawable3DComponent.hpp"
namespace BBM
{
AnimationsSystem::AnimationsSystem()
: WAL::System({typeid(AnimationsComponent),
typeid(Drawable3DComponent<RAY::Drawables::Drawables3D::Model>)})
{
}
void AnimationsSystem::onFixedUpdate(WAL::Entity &entity)
{
auto &model = entity.getComponent<Drawable3DComponent<RAY::Drawables::Drawables3D::Model>>();
auto &anim = entity.getComponent<AnimationsComponent>();
model.member.setAnimation(anim.getCurrentModelAnim());
anim.setAnimFrameCounter(anim.getAnimFrameCounter() + 1);
}
}