Skip to main content

ChaseComponent Class

Component storing chase behavior data. More...

Declaration

class helios::engine::modules::ai::components::ChaseComponent { ... }

Public Constructors Index

ChaseComponent ()=default

Default constructor. More...

ChaseComponent (const ChaseComponent &other)
ChaseComponent (ChaseComponent &&) noexcept=default

Public Operators Index

ChaseComponent &operator= (const ChaseComponent &)=default
ChaseComponent &operator= (ChaseComponent &&) noexcept=default

Public Member Functions Index

boolisEnabled () const noexcept

Checks whether this component is enabled. More...

voidenable () noexcept

Enables this component. More...

voiddisable () noexcept

Disables this component. More...

helios::engine::ecs::EntityHandletarget () const noexcept

Returns the target entity's handle. More...

floatcooldown () const noexcept

Returns the cooldown duration. More...

voidsetCooldown (const float cooldown) noexcept

Sets the cooldown duration. More...

floatcooldownTimer () const noexcept

Returns the current cooldown timer value. More...

voidupdateCooldownTimerBy (const float delta) noexcept

Advances the cooldown timer by delta time. More...

voidsetCooldownTimer (const float timer) noexcept

Sets the cooldown timer to a specific value. More...

voidsetTarget (const helios::engine::ecs::EntityHandle &entityHandle) noexcept

Sets the target entity to chase. More...

Private Member Attributes Index

floatcooldown_ = 0.0f

Time between target direction updates (seconds). More...

floatcooldownTimer_ = 0.0f

Current elapsed time since last update. More...

helios::engine::ecs::EntityHandletarget_ {}

EntityHandle of the entity to chase. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component storing chase behavior data.

Tracks a target entity by handle and controls the frequency of direction updates via a cooldown timer. Used by ChaseSystem to steer entities towards their targets.

Definition at line 27 of file ChaseComponent.ixx.

Public Constructors

ChaseComponent()

helios::engine::modules::ai::components::ChaseComponent::ChaseComponent ()
default

Default constructor.

Definition at line 77 of file ChaseComponent.ixx.

Referenced by ChaseComponent, ChaseComponent, operator= and operator=.

ChaseComponent()

helios::engine::modules::ai::components::ChaseComponent::ChaseComponent (const ChaseComponent & other)
inline

Definition at line 79 of file ChaseComponent.ixx.

80 cooldown_(other.cooldown_), cooldownTimer_(other.cooldownTimer_), target_(other.target_) {} ;

Reference ChaseComponent.

ChaseComponent()

helios::engine::modules::ai::components::ChaseComponent::ChaseComponent (ChaseComponent &&)
noexcept default

Definition at line 82 of file ChaseComponent.ixx.

Reference ChaseComponent.

Public Operators

operator=()

ChaseComponent & helios::engine::modules::ai::components::ChaseComponent::operator= (const ChaseComponent &)
default

Definition at line 81 of file ChaseComponent.ixx.

Reference ChaseComponent.

operator=()

ChaseComponent & helios::engine::modules::ai::components::ChaseComponent::operator= (ChaseComponent &&)
noexcept default

Definition at line 83 of file ChaseComponent.ixx.

Reference ChaseComponent.

Public Member Functions

cooldown()

float helios::engine::modules::ai::components::ChaseComponent::cooldown ()
inline nodiscard noexcept

Returns the cooldown duration.

Returns

Time between direction updates in seconds.

Definition at line 99 of file ChaseComponent.ixx.

99 [[nodiscard]] float cooldown() const noexcept {
100 return cooldown_;
101 }

Referenced by setCooldown.

cooldownTimer()

float helios::engine::modules::ai::components::ChaseComponent::cooldownTimer ()
inline nodiscard noexcept

Returns the current cooldown timer value.

Returns

Elapsed time since last direction update.

Definition at line 117 of file ChaseComponent.ixx.

117 [[nodiscard]] float cooldownTimer() const noexcept {
118 return cooldownTimer_;
119 }

disable()

void helios::engine::modules::ai::components::ChaseComponent::disable ()
inline noexcept

Disables this component.

Definition at line 70 of file ChaseComponent.ixx.

70 void disable() noexcept {
71 isEnabled_ = false;
72 }

enable()

void helios::engine::modules::ai::components::ChaseComponent::enable ()
inline noexcept

Enables this component.

Definition at line 63 of file ChaseComponent.ixx.

63 void enable() noexcept {
64 isEnabled_ = true;
65 }

isEnabled()

bool helios::engine::modules::ai::components::ChaseComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 56 of file ChaseComponent.ixx.

56 [[nodiscard]] bool isEnabled() const noexcept {
57 return isEnabled_;
58 }

setCooldown()

void helios::engine::modules::ai::components::ChaseComponent::setCooldown (const float cooldown)
inline noexcept

Sets the cooldown duration.

Parameters
cooldown

Time between direction updates in seconds.

Definition at line 108 of file ChaseComponent.ixx.

108 void setCooldown(const float cooldown) noexcept {
109 cooldown_ = cooldown;
110 }

Reference cooldown.

setCooldownTimer()

void helios::engine::modules::ai::components::ChaseComponent::setCooldownTimer (const float timer)
inline noexcept

Sets the cooldown timer to a specific value.

Parameters
timer

New timer value.

Definition at line 135 of file ChaseComponent.ixx.

135 void setCooldownTimer(const float timer) noexcept {
136 cooldownTimer_ = timer;
137 }

setTarget()

void helios::engine::modules::ai::components::ChaseComponent::setTarget (const helios::engine::ecs::EntityHandle & entityHandle)
inline noexcept

Sets the target entity to chase.

Parameters
entityHandle

The EntityHandle of the target entity.

Definition at line 144 of file ChaseComponent.ixx.

144 void setTarget(const helios::engine::ecs::EntityHandle& entityHandle) noexcept {
145 assert(entityHandle.isValid() && "Unexpected invalid entityHandle");
146 target_ = entityHandle;
147 }

target()

helios::engine::ecs::EntityHandle helios::engine::modules::ai::components::ChaseComponent::target ()
inline nodiscard noexcept

Returns the target entity's handle.

Returns

The handle of the chase target.

Definition at line 90 of file ChaseComponent.ixx.

90 [[nodiscard]] helios::engine::ecs::EntityHandle target() const noexcept {
91 return target_;
92 }

Reference target.

Referenced by target.

updateCooldownTimerBy()

void helios::engine::modules::ai::components::ChaseComponent::updateCooldownTimerBy (const float delta)
inline noexcept

Advances the cooldown timer by delta time.

Parameters
delta

Time to add to the timer.

Definition at line 126 of file ChaseComponent.ixx.

126 void updateCooldownTimerBy(const float delta) noexcept {
127 cooldownTimer_ += delta;
128 }

Private Member Attributes

cooldown_

float helios::engine::modules::ai::components::ChaseComponent::cooldown_ = 0.0f

Time between target direction updates (seconds).

Definition at line 32 of file ChaseComponent.ixx.

32 float cooldown_ = 0.0f;

cooldownTimer_

float helios::engine::modules::ai::components::ChaseComponent::cooldownTimer_ = 0.0f

Current elapsed time since last update.

Definition at line 37 of file ChaseComponent.ixx.

37 float cooldownTimer_ = 0.0f;

isEnabled_

bool helios::engine::modules::ai::components::ChaseComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 47 of file ChaseComponent.ixx.

47 bool isEnabled_ = true;

target_

helios::engine::ecs::EntityHandle helios::engine::modules::ai::components::ChaseComponent::target_ {}

EntityHandle of the entity to chase.

Definition at line 42 of file ChaseComponent.ixx.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.