cs381/as6/components/LifetimeComponent.cpp

16 lines
348 B
C++

#include "components/LifetimeComponent.hpp"
#include "Entity.hpp"
void LifetimeComponent::Setup() {}
void LifetimeComponent::Update(float dt) {
remaining -= dt;
if (remaining <= 0.0f) {
// helper component that simply removes itself when the ttl expires
entity->QueueFree();
}
}
void LifetimeComponent::Cleanup() {}