R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ecs::OrbitalSystem Class Reference

System managing orbital module movement around parent entities. More...

#include <OrbitalSystem.hpp>

Inheritance diagram for ecs::OrbitalSystem:
Inheritance graph
Collaboration diagram for ecs::OrbitalSystem:
Collaboration graph

Public Member Functions

 OrbitalSystem ()=default
 Default constructor.
 
 ~OrbitalSystem () override=default
 Default destructor.
 
void update (Registry &registry, float deltaTime) override
 Updates all orbital module positions.
 
ComponentMask getComponentMask () const override
 Gets the component mask for this system.
 
- Public Member Functions inherited from ecs::ISystem
virtual ~ISystem ()=default
 Virtual destructor.
 

Private Member Functions

void updateOrbitalPosition (Registry &registry, Address moduleEntity, OrbitalModule &orbital, Transform &transform, float deltaTime)
 Updates a single orbital module's position.
 

Detailed Description

System managing orbital module movement around parent entities.

Updates positions of entities with OrbitalModule components to orbit around their parent entities. Uses circular motion with constant radius. Requires OrbitalModule and Transform components.

Definition at line 23 of file OrbitalSystem.hpp.

Constructor & Destructor Documentation

◆ OrbitalSystem()

ecs::OrbitalSystem::OrbitalSystem ( )
default

Default constructor.

◆ ~OrbitalSystem()

ecs::OrbitalSystem::~OrbitalSystem ( )
overridedefault

Default destructor.

Member Function Documentation

◆ getComponentMask()

ComponentMask ecs::OrbitalSystem::getComponentMask ( ) const
overridevirtual

Gets the component mask for this system.

Returns
ComponentMask requiring OrbitalModule and Transform components

Implements ecs::ISystem.

Definition at line 72 of file OrbitalSystem.cpp.

Referenced by update().

◆ update()

void ecs::OrbitalSystem::update ( Registry registry,
float  deltaTime 
)
overridevirtual

Updates all orbital module positions.

Updates all orbital modules for the current frame.

For each orbital module:

  1. Finds parent entity position
  2. Updates orbital angle based on speed and deltaTime
  3. Calculates new position using circular motion
Parameters
registryReference to the ECS registry
deltaTimeTime elapsed since last frame (in seconds)

Implements ecs::ISystem.

Definition at line 18 of file OrbitalSystem.cpp.

References ecs::Registry::getComponent(), getComponentMask(), ecs::Registry::getEntitiesWithMask(), and updateOrbitalPosition().

Here is the call graph for this function:

◆ updateOrbitalPosition()

void ecs::OrbitalSystem::updateOrbitalPosition ( Registry registry,
Address  moduleEntity,
OrbitalModule orbital,
Transform transform,
float  deltaTime 
)
private

Updates a single orbital module's position.

Parameters
registryReference to the ECS registry
moduleEntityEntity ID of the orbital module
orbitalOrbitalModule component
transformTransform component to update
deltaTimeTime elapsed since last frame

Definition at line 32 of file OrbitalSystem.cpp.

References ecs::Registry::getComponent(), ecs::OrbitalModule::getCurrentAngle(), ecs::OrbitalModule::getOrbitRadius(), ecs::OrbitalModule::getOrbitSpeed(), ecs::OrbitalModule::getParentEntityId(), ecs::Transform::getPosition(), ecs::Registry::hasComponent(), LOG_DEBUG, ecs::Registry::setComponent(), ecs::OrbitalModule::setCurrentAngle(), and ecs::Transform::setPosition().

Referenced by update().

Here is the call graph for this function:

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