Files
Bomberman/sources/System/Movable/MovableSystem.cpp
2021-06-04 00:50:38 +02:00

24 lines
582 B
C++

//
// Created by Zoe Roux on 5/17/21.
//
#include "Component/Position/PositionComponent.hpp"
#include "MovableSystem.hpp"
#include "Component/Movable/MovableComponent.hpp"
namespace BBM
{
MovableSystem::MovableSystem(WAL::Wal &wal)
: System(wal)
{}
void MovableSystem::onFixedUpdate(WAL::Entity &entity)
{
auto &movable = entity.getComponent<MovableComponent>();
auto &position = entity.getComponent<PositionComponent>();
position.position += movable._velocity;
movable._velocity = movable._acceleration;
movable._acceleration = Vector3f();
}
} // namespace WAL