From 0084224e18c00607909ac55d322daf2e7ea60e5b Mon Sep 17 00:00:00 2001 From: William Moberg Date: Sun, 13 Mar 2016 23:23:05 +0100 Subject: [PATCH] WIP, dash effect fade weapon. --- src/Game/Systems/PlayerMovementSystem.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 7b49f474..74a8de7e 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -64,7 +64,7 @@ void PlayerMovementSystem::Update(double dt) // } //} m_DashEffectTimer += dt; - if (m_DashEffectTimer < 0.046f) { + if (m_DashEffectTimer < 0.075f) { return; } m_DashEffectTimer = 0.f; @@ -89,6 +89,13 @@ void PlayerMovementSystem::Update(double dt) for (auto& cAnim : dashEffect.ChildrenWithComponent("Animation")) { cAnim["Animation"]["Play"] = false; } + for (auto& cModel : dashEffect.ChildrenWithComponent("Model")) { + Entity.AttachComponent("Lifetime"); + dashEffect.AttachComponent("Fade"); + dashEffect["Fade"]["Loop"] = false; + dashEffect["Fade"]["FadeTime"] = 0.5; + dashEffect["Fade"]["Time"] = (double)dashEffect["Fade"]["FadeTime"]; + } dashEffect.AttachComponent("Lifetime"); dashEffect.AttachComponent("Fade"); dashEffect["Fade"]["Loop"] = false;