DamageDealerComponent Class
Component that stores damage values per collision layer. More...
Declaration
Public Constructors Index
| DamageDealerComponent ()=default | |
| DamageDealerComponent (const DamageDealerComponent &other) | |
|
Copy constructor. More... | |
| DamageDealerComponent (DamageDealerComponent &&) noexcept=default | |
Public Operators Index
| DamageDealerComponent & | operator= (const DamageDealerComponent &)=default |
| DamageDealerComponent & | operator= (DamageDealerComponent &&) noexcept=default |
Public Member Functions Index
| bool | isEnabled () const noexcept |
|
Checks whether this component is enabled. More... | |
| void | enable () noexcept |
|
Enables this component. More... | |
| void | disable () noexcept |
|
Disables this component. More... | |
| DamageDealerComponent & | setDamage (const float damage, const uint32_t otherLayerId) noexcept |
|
Sets the damage dealt to entities on a specific layer. More... | |
| float | damage (const uint32_t otherLayerId) const noexcept |
|
Returns the damage dealt to entities on a specific layer. More... | |
Private Member Attributes Index
| std::array< float, helios::engine::modules::physics::collision::types::MAX_COLLISION_LAYERS > | damageRegistry_ {} |
|
Damage values indexed by collision layer. More... | |
| bool | isEnabled_ = true |
|
Whether this component is enabled. More... | |
Description
Component that stores damage values per collision layer.
Allows an entity to deal different amounts of damage depending on which collision layer the target belongs to. Uses a fixed-size array indexed by layer ID for O(1) damage lookup.
Definition at line 30 of file DamageDealerComponent.ixx.
Public Constructors
DamageDealerComponent()
| default |
Definition at line 69 of file DamageDealerComponent.ixx.
Referenced by DamageDealerComponent, DamageDealerComponent, operator=, operator= and setDamage.
DamageDealerComponent()
| inline |
Copy constructor.
- Parameters
-
other The component to copy from.
Definition at line 76 of file DamageDealerComponent.ixx.
Reference DamageDealerComponent.
DamageDealerComponent()
| noexcept default |
Definition at line 79 of file DamageDealerComponent.ixx.
Reference DamageDealerComponent.
Public Operators
operator=()
| default |
Definition at line 78 of file DamageDealerComponent.ixx.
Reference DamageDealerComponent.
operator=()
| noexcept default |
Definition at line 80 of file DamageDealerComponent.ixx.
Reference DamageDealerComponent.
Public Member Functions
damage()
| inline nodiscard noexcept |
Returns the damage dealt to entities on a specific layer.
- Parameters
-
otherLayerId The target collision layer ID (must be a power of 2).
- Returns
The damage value for the specified layer.
Definition at line 111 of file DamageDealerComponent.ixx.
Referenced by setDamage.
disable()
| inline noexcept |
Disables this component.
Definition at line 65 of file DamageDealerComponent.ixx.
enable()
| inline noexcept |
Enables this component.
Definition at line 58 of file DamageDealerComponent.ixx.
isEnabled()
| inline nodiscard noexcept |
Checks whether this component is enabled.
- Returns
True if enabled, false otherwise.
Definition at line 51 of file DamageDealerComponent.ixx.
setDamage()
| inline noexcept |
Sets the damage dealt to entities on a specific layer.
- Parameters
-
damage The damage value to deal.
otherLayerId The target collision layer ID (must be a power of 2).
- Returns
Reference to this component for method chaining.
Definition at line 90 of file DamageDealerComponent.ixx.
References damage, DamageDealerComponent and setDamage.
Referenced by setDamage.
Private Member Attributes
damageRegistry_
|
Damage values indexed by collision layer.
Definition at line 37 of file DamageDealerComponent.ixx.
isEnabled_
|
Whether this component is enabled.
Definition at line 42 of file DamageDealerComponent.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.