Skip to main content

Aim2DCommand Class

Command that applies 2D aiming direction to a GameObject. More...

Declaration

class helios::engine::mechanics::combat::commands::Aim2DCommand { ... }

Base class

classTargetedCommand

Abstract base class for commands targeting a specific GameObject. More...

Public Constructors Index

Aim2DCommand (const helios::math::vec2f direction, const float freqFactor)

Constructs an aim command with direction and frequency. More...

Public Member Functions Index

voidexecute (helios::engine::ecs::GameObject &gameObject) const noexcept override

Executes the aim command on a GameObject. More...

Private Member Attributes Index

const floatfreqFactor_

The analog stick magnitude determining fire frequency. More...

const helios::math::vec2fdirection_

The normalized direction vector for aiming. More...

Description

Command that applies 2D aiming direction to a GameObject.

This command encapsulates an aim request consisting of a normalized direction vector and a frequency factor derived from analog stick magnitude. When executed, it invokes Aim2DComponent::aim() to update the aiming direction and fire frequency.

info

The target GameObject must have an Aim2DComponent attached for this command to have any effect.

See Also

helios::engine::runtime::messaging::command::Command

See Also

helios::engine::mechanics::components::Aim2DComponent

Definition at line 30 of file Aim2DCommand.ixx.

Public Constructors

Aim2DCommand()

helios::engine::mechanics::combat::commands::Aim2DCommand::Aim2DCommand (const helios::math::vec2f direction, const float freqFactor)
inline explicit

Constructs an aim command with direction and frequency.

Parameters
direction

Normalized 2D direction vector.

freqFactor

Magnitude of the stick input (0.0 to 1.0).

Definition at line 50 of file Aim2DCommand.ixx.

50 explicit Aim2DCommand(
51 const helios::math::vec2f direction,
52 const float freqFactor
53 ) :
54 direction_(direction),
55 freqFactor_(freqFactor)
56 {}

Public Member Functions

execute()

void helios::engine::mechanics::combat::commands::Aim2DCommand::execute (helios::engine::ecs::GameObject & gameObject)
inline noexcept virtual

Executes the aim command on a GameObject.

Parameters
gameObject

The target entity with an Aim2DComponent.

Definition at line 64 of file Aim2DCommand.ixx.

64 void execute(helios::engine::ecs::GameObject& gameObject) const noexcept override {
65
66 auto* aimComponent = gameObject.get<helios::engine::mechanics::combat::components::Aim2DComponent>();
67
68 if (aimComponent) {
69 aimComponent->aim(direction_, freqFactor_);
70 }
71
72 }

Private Member Attributes

direction_

const helios::math::vec2f helios::engine::mechanics::combat::commands::Aim2DCommand::direction_

The normalized direction vector for aiming.

Definition at line 40 of file Aim2DCommand.ixx.

40 const helios::math::vec2f direction_;

freqFactor_

const float helios::engine::mechanics::combat::commands::Aim2DCommand::freqFactor_

The analog stick magnitude determining fire frequency.

Definition at line 35 of file Aim2DCommand.ixx.

35 const float freqFactor_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.