diff --git a/sources/Component/Health/HealthComponent.cpp b/sources/Component/Health/HealthComponent.cpp index 20e2a3b6..5499d243 100644 --- a/sources/Component/Health/HealthComponent.cpp +++ b/sources/Component/Health/HealthComponent.cpp @@ -6,22 +6,14 @@ #include "HealthComponent.hpp" +#include + namespace BBM { - HealthComponent::HealthComponent(WAL::Entity &entity) - : WAL::Component(entity), - _healthPoint() - {} - - HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint) - : WAL::Component(entity), - _healthPoint(healthPoint) - {} - HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint, std::function callback) : WAL::Component(entity), _healthPoint(healthPoint), - onDeath(callback) + onDeath(std::move(callback)) {} WAL::Component *HealthComponent::clone(WAL::Entity &entity) const diff --git a/sources/Component/Health/HealthComponent.hpp b/sources/Component/Health/HealthComponent.hpp index 2ece2f0b..d8ff7531 100644 --- a/sources/Component/Health/HealthComponent.hpp +++ b/sources/Component/Health/HealthComponent.hpp @@ -34,15 +34,9 @@ namespace BBM //! @inherit WAL::Component *clone(WAL::Entity &entity) const override; - - //! @brief A Health component can't be instantiated, it should be derived. - explicit HealthComponent(WAL::Entity &entity); //! @brief Constructor - HealthComponent(WAL::Entity &entity, unsigned int healthPoint); - - //! @brief Constructor - HealthComponent(WAL::Entity &entity, unsigned int healthPoint, std::function callback); + explicit HealthComponent(WAL::Entity &entity, unsigned int healthPoint = 1, std::function callback = {}); //! @brief A Health component can't be instantiated, it should be derived. HealthComponent(const HealthComponent &) = default;