feat: changed timer mecanic and mage tower

This commit is contained in:
2021-10-11 19:09:56 +02:00
parent a6ccdcc7af
commit a62549e93e
3 changed files with 34 additions and 3 deletions

View File

@@ -30,6 +30,11 @@ void AutoTimer::reset() {
}
bool Timer::update(std::uint64_t delta) {
if (m_Waiting) {
m_InternalTime = 0;
m_Waiting = false;
return true;
}
m_InternalTime += delta;
if (m_InternalTime >= m_Interval) {
m_InternalTime %= m_Interval;
@@ -38,8 +43,13 @@ bool Timer::update(std::uint64_t delta) {
return false;
}
void Timer::wait() {
m_Waiting = true;
}
void Timer::reset() {
m_InternalTime = 0;
m_InternalTime = 0; // let the timer active once at the beginning
m_Waiting = true;
}
std::uint64_t getTime() {