From a8cd709874cdece66410ee36f0ee723b3ab086a1 Mon Sep 17 00:00:00 2001 From: TrueBabyChaise Date: Thu, 20 May 2021 16:50:00 +0200 Subject: [PATCH] Fix HealthComponent --- sources/Component/Health/HealthComponent.cpp | 7 +++-- sources/System/Health/HealthSystem.cpp | 19 ------------- sources/System/Health/HealthSystem.hpp | 30 -------------------- 3 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 sources/System/Health/HealthSystem.cpp delete mode 100644 sources/System/Health/HealthSystem.hpp diff --git a/sources/Component/Health/HealthComponent.cpp b/sources/Component/Health/HealthComponent.cpp index b08845d0..28e93b1a 100644 --- a/sources/Component/Health/HealthComponent.cpp +++ b/sources/Component/Health/HealthComponent.cpp @@ -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) } } \ No newline at end of file diff --git a/sources/System/Health/HealthSystem.cpp b/sources/System/Health/HealthSystem.cpp deleted file mode 100644 index 073f56e9..00000000 --- a/sources/System/Health/HealthSystem.cpp +++ /dev/null @@ -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) - { - - } -} diff --git a/sources/System/Health/HealthSystem.hpp b/sources/System/Health/HealthSystem.hpp deleted file mode 100644 index 59215af0..00000000 --- a/sources/System/Health/HealthSystem.hpp +++ /dev/null @@ -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; - } -} \ No newline at end of file