// // Created by cbihan on 01/06/2021. // #include #include "AnimationsSystem.hpp" #include "Component/Animation/AnimationsComponent.hpp" #include "Model/Model.hpp" #include "Component/Renderer/Drawable3DComponent.hpp" namespace BBM { AnimationsSystem::AnimationsSystem(WAL::Wal &wal) : System(wal) {} void AnimationsSystem::onFixedUpdate(WAL::ViewEntity &entity) { auto &model = entity.get(); auto &anim = entity.get(); static int count = 0; if (anim.skipNext) { anim.skipNext = false; return; } anim.skipNext = true; if (anim.isDisabled()) return; auto modelPtr = std::dynamic_pointer_cast(model.drawable); if (modelPtr) { modelPtr->setAnimation(anim.getCurrentModelAnim()); anim.incCurrentAnimFrameCounter(); anim.incCurrentAnimFrameCounter(); anim.incCurrentAnimFrameCounter(); anim.incCurrentAnimFrameCounter(); } } }