Skip to main content

Aim2DComponent Class

Component for handling 2D aiming direction and fire frequency. More...

Declaration

class helios::engine::mechanics::combat::components::Aim2DComponent { ... }

Public Constructors Index

Aim2DComponent ()=default
Aim2DComponent (const Aim2DComponent &)=default
Aim2DComponent (Aim2DComponent &&) noexcept=default

Public Operators Index

Aim2DComponent &operator= (const Aim2DComponent &)=default
Aim2DComponent &operator= (Aim2DComponent &&) 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...

voidaim (helios::math::vec2f direction, float freq)

Sets the aim direction and fire frequency. More...

const helios::math::vec2f &direction () const noexcept

Returns the current aim direction. More...

floatfrequency () const noexcept

Returns the current frequency factor. More...

Protected Member Attributes Index

helios::math::vec2fdirection_ {0.0f, 0.0f}

Current aim direction as normalized 2D vector. More...

floatfrequency_ = 0.0f

Current frequency factor (0.0 to 1.0) for additional fire rate control. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component for handling 2D aiming direction and fire frequency.

Receives aim direction and frequency factor from Aim2DCommand. Derived classes can override to implement specific aiming behaviors such as cannon rotation or crosshair positioning.

info

This is a base implementation with empty methods. Derive from this class to implement game-specific aiming logic.

Definition at line 29 of file Aim2DComponent.ixx.

Public Constructors

Aim2DComponent()

helios::engine::mechanics::combat::components::Aim2DComponent::Aim2DComponent ()
default

Definition at line 73 of file Aim2DComponent.ixx.

Referenced by Aim2DComponent, Aim2DComponent, operator= and operator=.

Aim2DComponent()

helios::engine::mechanics::combat::components::Aim2DComponent::Aim2DComponent (const Aim2DComponent &)
default

Definition at line 74 of file Aim2DComponent.ixx.

Reference Aim2DComponent.

Aim2DComponent()

helios::engine::mechanics::combat::components::Aim2DComponent::Aim2DComponent (Aim2DComponent &&)
noexcept default

Definition at line 76 of file Aim2DComponent.ixx.

Reference Aim2DComponent.

Public Operators

operator=()

Aim2DComponent & helios::engine::mechanics::combat::components::Aim2DComponent::operator= (const Aim2DComponent &)
default

Definition at line 75 of file Aim2DComponent.ixx.

Reference Aim2DComponent.

operator=()

Aim2DComponent & helios::engine::mechanics::combat::components::Aim2DComponent::operator= (Aim2DComponent &&)
noexcept default

Definition at line 77 of file Aim2DComponent.ixx.

Reference Aim2DComponent.

Public Member Functions

aim()

void helios::engine::mechanics::combat::components::Aim2DComponent::aim (helios::math::vec2f direction, float freq)
inline

Sets the aim direction and fire frequency.

Parameters
direction

Normalized 2D direction vector.

freq

Fire frequency factor (0.0 to 1.0).

Definition at line 85 of file Aim2DComponent.ixx.

85 void aim(helios::math::vec2f direction, float freq) {
87 direction_ = {};
88 frequency_ = 0.0f;
89 }
91 frequency_ = freq;
92 }

References aim, direction, direction_, helios::math::EPSILON_LENGTH and frequency_.

Referenced by aim.

direction()

const helios::math::vec2f & helios::engine::mechanics::combat::components::Aim2DComponent::direction ()
inline nodiscard noexcept

Returns the current aim direction.

Returns

Const reference to the normalized 2D direction vector.

Definition at line 100 of file Aim2DComponent.ixx.

100 [[nodiscard]] const helios::math::vec2f& direction() const noexcept {
101 return direction_;
102 }

Reference direction_.

Referenced by aim.

disable()

void helios::engine::mechanics::combat::components::Aim2DComponent::disable ()
inline noexcept

Disables this component.

Definition at line 69 of file Aim2DComponent.ixx.

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

Reference isEnabled_.

enable()

void helios::engine::mechanics::combat::components::Aim2DComponent::enable ()
inline noexcept

Enables this component.

Definition at line 62 of file Aim2DComponent.ixx.

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

Reference isEnabled_.

frequency()

float helios::engine::mechanics::combat::components::Aim2DComponent::frequency ()
inline nodiscard noexcept

Returns the current frequency factor.

Returns

Fire frequency factor in range [0.0, 1.0].

Definition at line 109 of file Aim2DComponent.ixx.

109 [[nodiscard]] float frequency() const noexcept {
110 return frequency_;
111 }

Reference frequency_.

isEnabled()

bool helios::engine::mechanics::combat::components::Aim2DComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 55 of file Aim2DComponent.ixx.

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

Reference isEnabled_.

Protected Member Attributes

direction_

helios::math::vec2f helios::engine::mechanics::combat::components::Aim2DComponent::direction_ {0.0f, 0.0f}
protected

Current aim direction as normalized 2D vector.

Definition at line 36 of file Aim2DComponent.ixx.

Referenced by aim and direction.

frequency_

float helios::engine::mechanics::combat::components::Aim2DComponent::frequency_ = 0.0f
protected

Current frequency factor (0.0 to 1.0) for additional fire rate control.

Definition at line 41 of file Aim2DComponent.ixx.

41 float frequency_ = 0.0f;

Referenced by aim and frequency.

isEnabled_

bool helios::engine::mechanics::combat::components::Aim2DComponent::isEnabled_ = true
protected

Whether this component is enabled.

Definition at line 46 of file Aim2DComponent.ixx.

46 bool isEnabled_ = true;

Referenced by disable, enable and isEnabled.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.