feat: add cooldown timer

This commit is contained in:
2021-11-09 19:18:24 +01:00
parent f71f69cfc2
commit 9a256a4c66
4 changed files with 39 additions and 28 deletions

View File

@@ -93,7 +93,7 @@ private:
TowerLevel m_Level{};
PlayerID m_Builder;
protected:
utils::Timer m_Timer;
utils::CooldownTimer m_Timer;
public:
Tower(TowerID id, TowerType type, std::uint16_t x, std::uint16_t y, PlayerID builder) : m_ID(id), m_Type(type), m_X(x), m_Y(y), m_Builder(builder),
m_Timer(getStats()->getDamageRate() * 1000) { // converting seconds to millis
@@ -107,7 +107,7 @@ public:
void upgrade(std::uint8_t level, TowerPath path) {
m_Level.setLevel(level);
m_Level.setPath(path);
m_Timer.setInterval(getStats()->getDamageRate() * 1000); // converting seconds to millis
m_Timer.setCooldown(getStats()->getDamageRate() * 1000); // converting seconds to millis
m_Timer.reset();
}