From 6cb50eafafaf940b9016015fe9a4b2a448e5c2bb Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 22 Dec 2022 19:53:25 +0100 Subject: Added a property to Timed to scale it according to time factor --- kurator/src/Battle.cpp | 4 ++-- kurator/src/components.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp index 6c86c25..8ecd571 100644 --- a/kurator/src/Battle.cpp +++ b/kurator/src/Battle.cpp @@ -59,7 +59,7 @@ Battle::update(const float dt) auto& registry = battle->registry(); auto timers = registry.view(); for (auto&& [entity, timer] : timers.each()) { - timer.left -= dt; + timer.left -= timer.scaled ? dt * time_factor : dt; if (timer.left < 0.0) registry.destroy(entity); } @@ -145,7 +145,7 @@ Battle::on_hit(const sim::Hit& hit) registry.emplace(popup, 0, 0); registry.emplace(popup, sim::Point{0.0, -20}, 0.9998); const auto line = registry.create(); - registry.emplace(line, 0.2); + registry.emplace(line, 0.2, true); registry.emplace(line, RED, source.position, victim.position); } diff --git a/kurator/src/components.h b/kurator/src/components.h index 5c4a32d..0da3d6b 100644 --- a/kurator/src/components.h +++ b/kurator/src/components.h @@ -14,6 +14,7 @@ namespace kurator struct Timed { double left; + bool scaled = false; }; -- cgit v1.1