mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-20 21:35:12 +00:00
25 lines
554 B
C++
25 lines
554 B
C++
//
|
|
// Created by Tom Augier on 2021-06-09.
|
|
//
|
|
|
|
#include "BumperTimerSystem.hpp"
|
|
|
|
namespace BBM
|
|
{
|
|
BumperTimerSystem::BumperTimerSystem(WAL::Wal &wal)
|
|
: System(wal)
|
|
{}
|
|
|
|
void BumperTimerSystem::onUpdate(WAL::ViewEntity<BumperTimerComponent> &entity, std::chrono::nanoseconds dtime)
|
|
{
|
|
auto &bumperTimer = entity.get<BumperTimerComponent>();
|
|
|
|
if (bumperTimer._isReseting) {
|
|
bumperTimer.nextReset -= dtime;
|
|
if (bumperTimer.nextReset <= 0ns) {
|
|
bumperTimer.nextReset = bumperTimer.resetRate;
|
|
bumperTimer._isReseting = false;
|
|
}
|
|
}
|
|
}
|
|
} |