Added Speed and Delay fields to explosion effect.

This commit is contained in:
2016-03-07 19:38:02 +01:00
parent 1a403b9b88
commit 67ce6c5ae6
3 changed files with 14 additions and 6 deletions
+10 -6
View File
@@ -2,13 +2,17 @@
void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"]) {
(double)component["TimeSinceDeath"] = 0.f;
double& delay = (double)component["Delay"];
if (delay > 0) {
delay = std::max(0.0, delay - dt);
}
(double&)component["TimeSinceDeath"] += dt;
//if ((bool)Component["Gravity"] == true) {
// (bool)Component["ExponentialAccelaration"] = false;
//}
if (delay <= 0) {
double& timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (double)component["Speed"] * dt;
if (timeSinceDeath < 0 || timeSinceDeath > (double)component["ExplosionDuration"]) {
timeSinceDeath = 0.0;
}
}
}