Files
axyz/src/Game/Systems/ExplosionEffectSystem.cpp
T
William Moberg a3b3351e55 Merge branch 'master' into Dirtybit
# Conflicts:
#	include/Engine/Rendering/ExplosionEffectJob.h
#	src/Game/Systems/ExplosionEffectSystem.cpp
2016-03-12 17:59:50 +01:00

22 lines
621 B
C++

#include "Systems/ExplosionEffectSystem.h"
void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
Field<double> delay = component["Delay"];
if (delay > 0) {
delay = std::max(0.0, delay - dt);
}
if (delay <= 0) {
Field<double> timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (Field<double>)component["Speed"] * dt;
if (timeSinceDeath < 0) {
timeSinceDeath = 0.0;
}
else if (timeSinceDeath >(const double&)component["ExplosionDuration"]) {
timeSinceDeath = (const double&)component["ExplosionDuration"];
}
}
}