try to add death timer

This commit is contained in:
Askou
2021-06-17 09:52:45 +02:00
parent 5a948bca46
commit 1261476a00
3 changed files with 9 additions and 1 deletions
@@ -10,6 +10,7 @@
#include <Component/Controllable/ControllableComponent.hpp>
#include "AnimatorSystem.hpp"
#include "Component/Renderer/Drawable3DComponent.hpp"
#include "Component/Health/HealthComponent.hpp"
using Keyboard = RAY::Controller::Keyboard;
namespace RAY3D = RAY::Drawables::Drawables3D;
@@ -27,6 +28,10 @@ namespace BBM
auto drawable = entity.get<Drawable3DComponent>().drawable.get();
auto &animation = entity.get<AnimationsComponent>();
auto anim = dynamic_cast<RAY3D::Model *>(drawable);
auto health = entity->tryGetComponent<HealthComponent>();
if (health && health->getHealthPoint() <= 0)
return;
if (anim && controllable.move != Vector2f(0, 0)) {
anim->setRotationAngle(controllable.move.angle(Vector2f(-1, 0)));
animation.setAnimIndex(0);