Skip to main content

LivesComponent Class

Tracks the remaining lives of an entity. More...

Declaration

class helios::engine::mechanics::match::components::LivesComponent { ... }

Public Constructors Index

LivesComponent (const size_t lives) noexcept

Constructs a LivesComponent with an initial life count. More...

Public Member Functions Index

size_tlives () const noexcept

Returns the current life count. More...

size_tdecrease () noexcept

Decreases the life count by one and increments the revision. More...

size_tincrease () noexcept

Increases the life count by one and increments the revision. More...

LivesRevisionlivesRevision () const noexcept

Returns the current lives revision. More...

Private Member Attributes Index

size_tlives_

Current number of remaining lives. More...

LivesRevisionlivesRevision_ {1}

Monotonically increasing revision counter. More...

Description

Tracks the remaining lives of an entity.

Each modification increments an internal LivesRevision counter so that observer systems can detect changes without polling the value.

Definition at line 21 of file LivesComponent.ixx.

Public Constructors

LivesComponent()

helios::engine::mechanics::match::components::LivesComponent::LivesComponent (const size_t lives)
inline explicit noexcept

Constructs a LivesComponent with an initial life count.

Parameters
lives

Initial number of lives.

Definition at line 40 of file LivesComponent.ixx.

40 explicit LivesComponent(const size_t lives) noexcept : lives_(lives) {};

Reference lives.

Public Member Functions

decrease()

size_t helios::engine::mechanics::match::components::LivesComponent::decrease ()
inline noexcept

Decreases the life count by one and increments the revision.

Returns

The new life count after decrement.

Definition at line 56 of file LivesComponent.ixx.

56 size_t decrease() noexcept {
57 livesRevision_++;
58 return --lives_;
59 }

increase()

size_t helios::engine::mechanics::match::components::LivesComponent::increase ()
inline noexcept

Increases the life count by one and increments the revision.

Returns

The new life count after increment.

Definition at line 66 of file LivesComponent.ixx.

66 size_t increase() noexcept {
67 livesRevision_++;
68 return ++lives_;
69 }

lives()

size_t helios::engine::mechanics::match::components::LivesComponent::lives ()
inline nodiscard noexcept

Returns the current life count.

Returns

Remaining lives.

Definition at line 47 of file LivesComponent.ixx.

47 [[nodiscard]] size_t lives() const noexcept {
48 return lives_;
49 }

Referenced by LivesComponent.

livesRevision()

LivesRevision helios::engine::mechanics::match::components::LivesComponent::livesRevision ()
inline nodiscard noexcept

Returns the current lives revision.

Returns

The LivesRevision value.

Definition at line 76 of file LivesComponent.ixx.

76 [[nodiscard]] LivesRevision livesRevision() const noexcept {
77 return livesRevision_;
78 }

Private Member Attributes

lives_

size_t helios::engine::mechanics::match::components::LivesComponent::lives_

Current number of remaining lives.

Definition at line 26 of file LivesComponent.ixx.

26 size_t lives_;

livesRevision_

LivesRevision helios::engine::mechanics::match::components::LivesComponent::livesRevision_ {1}

Monotonically increasing revision counter.

Definition at line 31 of file LivesComponent.ixx.

31 LivesRevision livesRevision_{1};

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.