a3b3351e55
# Conflicts: # include/Engine/Rendering/ExplosionEffectJob.h # src/Game/Systems/ExplosionEffectSystem.cpp
22 lines
621 B
C++
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"];
|
|
}
|
|
}
|
|
}
|
|
|