Skip to main content

ScoreValueComponent Class Template

Template component that stores a score value of a specific type. More...

Declaration

template <typename T> class helios::engine::mechanics::scoring::components::ScoreValueComponent<T> { ... }

Public Constructors Index

template <typename... Args>
ScoreValueComponent (Args &&... args)

Constructs a ScoreValueComponent with forwarded arguments. More...

template <typename T>
ScoreValueComponent (const ScoreValueComponent &other)

Copy constructor. More...

template <typename T>
ScoreValueComponent (ScoreValueComponent &&other) noexcept=default

Public Operators Index

template <typename T>
ScoreValueComponent &operator= (const ScoreValueComponent &other)=default
template <typename T>
ScoreValueComponent &operator= (ScoreValueComponent &&other) noexcept=default

Public Member Functions Index

template <typename T>
boolisEnabled () const noexcept

Checks whether this component is enabled. More...

template <typename T>
voidenable () noexcept

Enables this component. More...

template <typename T>
voiddisable () noexcept

Disables this component. More...

template <typename T>
Tscore () const noexcept

Returns the stored score value. More...

Private Member Attributes Index

template <typename T>
Tscore_ {}

The score value instance. More...

template <typename T>
boolisEnabled_ = true

Whether this component is enabled. More...

Description

Template component that stores a score value of a specific type.

Attached to entities to define the score value awarded when that entity is involved in a scoring event (e.g., enemy killed). The template parameter must derive from Score.

Template Parameters
T

The score type (must derive from Score).

Definition at line 28 of file ScoreValueComponent.ixx.

Public Constructors

ScoreValueComponent()

template <typename... Args>
helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::ScoreValueComponent (Args &&... args)
inline explicit

Constructs a ScoreValueComponent with forwarded arguments.

Template Parameters
Args

Argument types for Score construction.

Parameters
args

Arguments forwarded to the Score constructor.

Definition at line 75 of file ScoreValueComponent.ixx.

75 explicit ScoreValueComponent(Args&&... args) : score_(std::forward<Args>(args)...) {}

Referenced by helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::operator=, helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::operator=, helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::ScoreValueComponent and helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::ScoreValueComponent.

ScoreValueComponent()

template <typename T>
helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::ScoreValueComponent (const ScoreValueComponent & other)
inline

Copy constructor.

Parameters
other

The component to copy from.

Definition at line 82 of file ScoreValueComponent.ixx.

82 ScoreValueComponent(const ScoreValueComponent& other) : score_(other.score_) {}

Reference helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::ScoreValueComponent.

ScoreValueComponent()

template <typename T>
helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::ScoreValueComponent (ScoreValueComponent && other)
noexcept default

Public Operators

operator=()

template <typename T>
ScoreValueComponent & helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::operator= (const ScoreValueComponent & other)
default

operator=()

template <typename T>
ScoreValueComponent & helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::operator= (ScoreValueComponent && other)
noexcept default

Public Member Functions

disable()

template <typename T>
void helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::disable ()
inline noexcept

Disables this component.

Definition at line 64 of file ScoreValueComponent.ixx.

64 void disable() noexcept {
65 isEnabled_ = false;
66 }

enable()

template <typename T>
void helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::enable ()
inline noexcept

Enables this component.

Definition at line 57 of file ScoreValueComponent.ixx.

57 void enable() noexcept {
58 isEnabled_ = true;
59 }

isEnabled()

template <typename T>
bool helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 50 of file ScoreValueComponent.ixx.

50 [[nodiscard]] bool isEnabled() const noexcept {
51 return isEnabled_;
52 }

score()

template <typename T>
T helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::score ()
inline nodiscard noexcept

Returns the stored score value.

Returns

The score instance.

Definition at line 96 of file ScoreValueComponent.ixx.

96 [[nodiscard]] T score() const noexcept {
97 return score_;
98 }

Private Member Attributes

isEnabled_

template <typename T>
bool helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::isEnabled_ = true

Whether this component is enabled.

Definition at line 40 of file ScoreValueComponent.ixx.

40 bool isEnabled_ = true;

score_

template <typename T>
T helios::engine::mechanics::scoring::components::ScoreValueComponent< T >::score_ {}

The score value instance.

Definition at line 35 of file ScoreValueComponent.ixx.

35 T score_{};

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.