Fix HealthComponent

This commit is contained in:
TrueBabyChaise
2021-05-20 16:50:00 +02:00
parent b318442dc8
commit a8cd709874
3 changed files with 4 additions and 52 deletions
+4 -3
View File
@@ -30,14 +30,15 @@ namespace BBM
void HealthComponent::takeDmg(unsigned int damage)
{
if (damage >= this->_healthPoint)
if (damage >= this->_healthPoint) {
this->_healthPoint = 0;
this->die();
else
} else
this->_healthPoint -= damage;
}
void HealthComponent::die(void)
{
this->setDisable(true);
this->_entity.setDisable(true)
}
}
-19
View File
@@ -1,19 +0,0 @@
//
// Edited by Benjamin Henry on 2021-05-20.
// Edited by Louis Auzuret on 2021-05-20.
//
#include "HealthSystem.hpp"
namespace BBM
{
const std::type_info &HealthSystem::getComponent() const
{
return typeid(HealthComponent);
}
void HealthSystem::onFixedUpdate(WAL::Entity &entity)
{
}
}
-30
View File
@@ -1,30 +0,0 @@
//
// Edited by Benjamin Henry on 2021-05-20.
// Edited by Louis Auzuret on 2021-05-20.
//
#pragma once
#include "Components/Health/HealthComponent.hpp"
#include "lib/wal/sources/System/System.hpp"
namespace BBM
{
class HealthSystem : public WAL::System
{
public:
//! @inherit
const std::type_info &getComponent() const override;
//! @inherit
void onFixedUpdate(Entity &entity) override;
//! @brief A default constructor
HealthSystem() = default;
//! @brief A health system is copy constructable
HealthSystem(const HealthSystem &) = default;
//! @brief A default destructor
~HealthSystem() override = default;
//! @brief A health system is assignable.
HealthSystem &operator=(const HealthSystem &) = default;
}
}