diff options
author | Aki <please@ignore.pl> | 2022-12-22 19:53:25 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-22 19:53:25 +0100 |
commit | 6cb50eafafaf940b9016015fe9a4b2a448e5c2bb (patch) | |
tree | c15571c9a258c16642afef9f2cc60c9baaf540e7 | |
parent | 63c797a6a80c76b98dc1d11acf3b74f8ae67e7f3 (diff) | |
download | kurator-6cb50eafafaf940b9016015fe9a4b2a448e5c2bb.zip kurator-6cb50eafafaf940b9016015fe9a4b2a448e5c2bb.tar.gz kurator-6cb50eafafaf940b9016015fe9a4b2a448e5c2bb.tar.bz2 |
Added a property to Timed to scale it according to time factor
-rw-r--r-- | kurator/src/Battle.cpp | 4 | ||||
-rw-r--r-- | 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<Timed>(); 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<UIOffset>(popup, 0, 0); registry.emplace<PopMove>(popup, sim::Point{0.0, -20}, 0.9998); const auto line = registry.create(); - registry.emplace<Timed>(line, 0.2); + registry.emplace<Timed>(line, 0.2, true); registry.emplace<Line>(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; }; |