mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-02 02:05:25 +00:00
Adding a timer component
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Zoe Roux on 5/31/21.
|
||||
//
|
||||
|
||||
#include "TimerComponent.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay)
|
||||
: WAL::Component(entity),
|
||||
ringIn(delay)
|
||||
{}
|
||||
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &> &callback)
|
||||
: WAL::Component(entity),
|
||||
ringIn(delay),
|
||||
callback(callback)
|
||||
{}
|
||||
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, std::function<void(WAL::Entity &)> callback)
|
||||
: WAL::Component(entity),
|
||||
ringIn(delay),
|
||||
callback(std::move(callback))
|
||||
{}
|
||||
|
||||
WAL::Component *TimerComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new TimerComponent(entity, this->ringIn, this->callback);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user