mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 03:25:10 +00:00
Merging with develop
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Models/Callback.hpp>
|
||||
#include "Component/Component.hpp"
|
||||
#include "Entity/Entity.hpp"
|
||||
|
||||
@@ -19,6 +20,9 @@ namespace BBM
|
||||
unsigned int _healthPoint;
|
||||
|
||||
public:
|
||||
//! @brief The callback invoked on this entity's death.
|
||||
WAL::Callback<WAL::Entity &> onDeath;
|
||||
|
||||
//! @brief add health to the entity
|
||||
void addHealthPoint(unsigned int healthPoint);
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace BBM
|
||||
ringIn(delay)
|
||||
{}
|
||||
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, const WAL::Wal &> &callback)
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, WAL::Wal &> &callback)
|
||||
: WAL::Component(entity),
|
||||
ringIn(delay),
|
||||
callback(callback)
|
||||
{}
|
||||
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, std::function<void(WAL::Entity &, const WAL::Wal &)> callback)
|
||||
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, std::function<void(WAL::Entity &, WAL::Wal &)> callback)
|
||||
: WAL::Component(entity),
|
||||
ringIn(delay),
|
||||
callback(std::move(callback))
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace BBM
|
||||
//! @brief A default constructor
|
||||
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay);
|
||||
//! @brief Create a timer with a callback.
|
||||
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, const WAL::Wal &> &callback);
|
||||
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, WAL::Wal &> &callback);
|
||||
//! @brief Create a timer with a function to call on ring.
|
||||
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, std::function<void (WAL::Entity &, const WAL::Wal &)> callback);
|
||||
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, std::function<void (WAL::Entity &, WAL::Wal &)> callback);
|
||||
//! @brief A timer component is copy constructable
|
||||
TimerComponent(const TimerComponent &) = default;
|
||||
//! @brief A default destructor
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BBM
|
||||
{
|
||||
wal.addSystem<TimerSystem>(wal)
|
||||
.addSystem<KeyboardSystem>()
|
||||
.addSystem<GamepadSystem>()
|
||||
.addSystem<GamepadSystem>()
|
||||
.addSystem<ControllableSystem>()
|
||||
.addSystem<BombHolderSystem>(wal)
|
||||
.addSystem<EventSystem>()
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace BBM
|
||||
{
|
||||
auto &health = entity.getComponent<HealthComponent>();
|
||||
|
||||
if (health.getHealthPoint() == 0);
|
||||
entity.setDisable(true);
|
||||
if (health.getHealthPoint() == 0)
|
||||
health.onDeath(entity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user