Added Speed and Delay fields to explosion effect.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user