imon's fix to rule them all

might have solved dt anormalities
This commit is contained in:
FakeShemp
2016-03-11 14:57:02 +01:00
parent 6c072aae45
commit 4df936ca70
+10 -7
View File
@@ -7,12 +7,15 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap
delay = std::max(0.0, delay - dt);
}
if (delay <= 0) {
double& timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (double)component["Speed"] * dt;
if (timeSinceDeath < 0 || timeSinceDeath > (double)component["ExplosionDuration"]) {
timeSinceDeath = 0.0;
}
}
if (delay <= 0) {
double& timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (double)component["Speed"] * dt;
if (timeSinceDeath < 0) {
timeSinceDeath = 0.0;
}
else if (timeSinceDeath >(double)component["ExplosionDuration"]) {
timeSinceDeath = (double)component["ExplosionDuration"];
}
}
}