31 std::vector<ecs::Entity> entitiesToRemove;
35 projectile.current_lifetime += dt;
36 if (projectile.current_lifetime >= projectile.lifetime)
38 entitiesToRemove.push_back(entity);
44 if (transform && velocity)
46 transform->
x += velocity->
x * dt;
47 transform->y += velocity->
y * dt;
51 for (
const auto &entity : entitiesToRemove)
This file contains the component definitions.
This file contains the IRenderer class declaration.
This file contains the Registry class declaration.
void update(ecs::Registry ®istry, float dt) override
ProjectileSystem(ProjectileSystem &&)=delete
ProjectileSystem & operator=(const ProjectileSystem &)=delete
ProjectileSystem(const ProjectileSystem &)=delete
~ProjectileSystem() override=default
ProjectileSystem & operator=(ProjectileSystem &&)=delete
ProjectileSystem(eng::IRenderer &)
Class for managing entities and their components.
bool hasComponent(Entity e)
std::unordered_map< Entity, T > & getAll()
T * getComponent(Entity e)
void removeComponent(Entity e)
Interface for the renderer.