mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-28 08:33:36 +00:00
Fix HealthComponent
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user