feat: add cooldown timer
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user