diff --git a/include/B-luga/Plugins/Systems/ECSCustomTypes.hpp b/include/B-luga/Plugins/Systems/ECSCustomTypes.hpp index aa4d3cd..9aed0a7 100644 --- a/include/B-luga/Plugins/Systems/ECSCustomTypes.hpp +++ b/include/B-luga/Plugins/Systems/ECSCustomTypes.hpp @@ -18,6 +18,12 @@ // all values are in percentage of the screen namespace Types { + struct Health { + int hp; + + NLOHMANN_DEFINE_TYPE_INTRUSIVE(Health, hp); + }; + struct CollisionRect { int width; int height; diff --git a/include/B-luga/Plugins/Systems/ECSSystems.hpp b/include/B-luga/Plugins/Systems/ECSSystems.hpp index a1e3edd..2d80d57 100644 --- a/include/B-luga/Plugins/Systems/ECSSystems.hpp +++ b/include/B-luga/Plugins/Systems/ECSSystems.hpp @@ -13,8 +13,8 @@ #include #include #include +#include "nlohmann/json.hpp" #include "B-luga/Json.hpp" -#include #include "B-luga/Plugins/Systems/ECSCustomTypes.hpp" #include "B-luga/Maths/Maths.hpp" #include "B-luga/Registry.hpp" @@ -66,8 +66,8 @@ namespace Systems { { Registry::components arrDamage = Registry::getInstance().getComponents(); - Registry::components arrHealth = - Registry::getInstance().getComponents(); + Registry::components arrHealth = + Registry::getInstance().getComponents(); if (arrDamage.exist(firstEntity) && arrDamage[firstEntity].damage > 0) { if (arrHealth.exist(secondEntity)) { @@ -200,8 +200,8 @@ namespace Systems { static void deathChecker(std::size_t /*unused*/, std::size_t /*unused*/) { std::lock_guard lock(Registry::getInstance().mutex); - Registry::components arrHealth = - Registry::getInstance().getComponents(); + Registry::components arrHealth = + Registry::getInstance().getComponents(); Registry::components arrDead = Registry::getInstance().getComponents(); std::vector ids = arrHealth.getExistingsId();