Making bomb explose

This commit is contained in:
Zoe Roux
2021-06-01 15:33:32 +02:00
parent 42a45a06ff
commit 9dca04e385
7 changed files with 34 additions and 11 deletions
+4 -3
View File
@@ -9,10 +9,11 @@ using namespace std::chrono_literals;
namespace BBM
{
TimerSystem::TimerSystem()
TimerSystem::TimerSystem(WAL::Wal &wal)
: WAL::System({
typeid(TimerComponent)
})
}),
_wal(wal)
{}
void TimerSystem::onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime)
@@ -21,7 +22,7 @@ namespace BBM
timer.ringIn -= dtime;
if (timer.ringIn <= 0ns) {
timer.setDisable(true);
timer.callback(entity);
timer.callback(entity, this->_wal);
}
}
}
+5 -1
View File
@@ -5,17 +5,21 @@
#pragma once
#include <System/System.hpp>
#include <Wal.hpp>
namespace BBM
{
class TimerSystem : public WAL::System
{
private:
//! @brief The wal engine
WAL::Wal &_wal;
public:
//! @inherit
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime) override;
//! @brief A default constructor
TimerSystem();
TimerSystem(WAL::Wal &);
//! @brief A timer system is copy constructable.
TimerSystem(const TimerSystem &) = default;
//! @brief A default destructor