9#include "../../Components/IComponent.hpp"
10#include "../../Components/PendingDestroy.hpp"
18 std::vector<std::uint32_t> toDestroy;
20 for (
auto entityId : entities) {
23 if (health.isInvincible()) {
25 health.setInvincibilityTimer(timer);
28 health.setInvincible(
false);
29 health.setInvincibilityTimer(0.0f);
33 if (health.getCurrentHealth() <= 0) {
34 toDestroy.push_back(entityId);
38 for (
auto entityId : toDestroy) {
47 return (1ULL << getComponentType<Health>());
void update(Registry ®istry, float deltaTime) override
Updates health-related logic for all entities.
ComponentMask getComponentMask() const override
Gets the component mask for this system.
Component representing entity health and invincibility.
float getInvincibilityTimer() const
Get remaining invincibility time.
Marker component indicating entity should be destroyed.
Manages entities, their signatures and component type registrations.
std::vector< Address > getEntitiesWithMask(Signature requiredMask)
Get all entities matching a specific component mask.
T & getComponent(Address address)
Get a component from an entity.
bool hasComponent(Address address)
Check if an entity has a specific component.
void setComponent(Address address, const T &component)
Set/add a component to an entity with its data.
Maximum number of distinct component types supported by the Registry.
std::uint64_t ComponentMask
Type alias for component bitmask.
@ Killed
Entity was killed (health <= 0)