From 3ba73b8206b4d3279d18d99a753c96e2bf110c93 Mon Sep 17 00:00:00 2001 From: FakeShemp Date: Tue, 1 Mar 2016 23:05:27 +0100 Subject: [PATCH] Pulsate system implemented. --- resources/Schema/Components/ExplosionEffect.xml | 2 ++ resources/Schema/Components/ExplosionEffect.xsd | 6 ++++++ src/Game/Systems/ExplosionEffectSystem.cpp | 13 ++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/resources/Schema/Components/ExplosionEffect.xml b/resources/Schema/Components/ExplosionEffect.xml index 22692729..1efe913b 100644 --- a/resources/Schema/Components/ExplosionEffect.xml +++ b/resources/Schema/Components/ExplosionEffect.xml @@ -14,4 +14,6 @@ 0 + 0 + 0 \ No newline at end of file diff --git a/resources/Schema/Components/ExplosionEffect.xsd b/resources/Schema/Components/ExplosionEffect.xsd index cdde5e52..77ed6d0b 100644 --- a/resources/Schema/Components/ExplosionEffect.xsd +++ b/resources/Schema/Components/ExplosionEffect.xsd @@ -51,6 +51,12 @@ Linear/Exponential accelaration + + Pulsate the effect + + + Reverse the effect + diff --git a/src/Game/Systems/ExplosionEffectSystem.cpp b/src/Game/Systems/ExplosionEffectSystem.cpp index 6ef668c0..d8944090 100644 --- a/src/Game/Systems/ExplosionEffectSystem.cpp +++ b/src/Game/Systems/ExplosionEffectSystem.cpp @@ -4,15 +4,18 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap { if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"]) { (double)component["TimeSinceDeath"] = 0.f; + if ((bool)component["Pulsate"] == true) { + (bool)component["Reverse"] = false; + } } //((glm::vec2)component["Velocity"]).x = min(((glm::vec2)component["Velocity"]).x, ((glm::vec2)component["Velocity"]).y); (double&)component["TimeSinceDeath"] += dt; - //if ((bool)component["Pulsate"] == true) { - // if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"] * 0.5) { - // (bool)component["Reverse"] = true; - // } - //} + if ((bool)component["Pulsate"] == true) { + if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"] * 0.5) { + (bool)component["Reverse"] = true; + } + } } \ No newline at end of file