R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
PendingDestroy.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** RTYPE
4** File description:
5** PendingDestroy - Marker component for entities to be destroyed
6*/
7
8#pragma once
9
10#include "IComponent.hpp"
11
12namespace ecs {
17 enum class DestroyReason {
18 OutOfBounds = 0,
19 Killed = 1,
20 Expired = 2,
21 Manual = 3
22 };
23
34 class PendingDestroy : public IComponent {
35 public:
40
45 explicit PendingDestroy(DestroyReason reason) : _reason(reason) {}
46
47 ~PendingDestroy() override = default;
48
53 DestroyReason getReason() const { return _reason; }
54
59 ComponentType getType() const override { return getComponentType<PendingDestroy>(); }
60
61 private:
63 };
64} // namespace ecs
Base interface for all ECS components.
Marker component indicating entity should be destroyed.
ComponentType getType() const override
Get component type ID.
~PendingDestroy() override=default
DestroyReason getReason() const
Get the destruction reason.
PendingDestroy(DestroyReason reason)
Constructor with specific reason.
PendingDestroy()
Default constructor with OutOfBounds reason.
Maximum number of distinct component types supported by the Registry.
Definition GameLogic.hpp:26
std::size_t ComponentType
Type alias for component identification.
DestroyReason
Reason why an entity is being destroyed.
@ Expired
Entity lifetime expired (e.g., projectile)
@ OutOfBounds
Entity went outside screen boundaries.
@ Manual
Manually destroyed (script, etc.)
@ Killed
Entity was killed (health <= 0)