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

Component for entities that orbit around a parent entity (like drones in Isaac). More...

#include <OrbitalModule.hpp>

Inheritance diagram for ecs::OrbitalModule:
Inheritance graph
Collaboration diagram for ecs::OrbitalModule:
Collaboration graph

Public Member Functions

 OrbitalModule (uint32_t parentEntityId, float orbitRadius, float orbitSpeed, float startAngle=0.0f, int damage=10)
 Constructor with all orbital parameters.
 
 ~OrbitalModule () override=default
 
uint32_t getParentEntityId () const
 Get parent entity ID.
 
float getOrbitRadius () const
 Get orbit radius.
 
float getOrbitSpeed () const
 Get orbit speed.
 
float getCurrentAngle () const
 Get current angle.
 
int getDamage () const
 Get contact damage.
 
bool blocksProjectiles () const
 Check if blocks projectiles.
 
void setParentEntityId (uint32_t parentEntityId)
 Set parent entity ID.
 
void setOrbitRadius (float orbitRadius)
 Set orbit radius.
 
void setOrbitSpeed (float orbitSpeed)
 Set orbit speed.
 
void setCurrentAngle (float angle)
 Set current angle.
 
void setDamage (int damage)
 Set contact damage.
 
void setBlocksProjectiles (bool blocks)
 Set projectile blocking status.
 
ComponentType getType () const override
 Get the component type ID.
 
- Public Member Functions inherited from ecs::IComponent
virtual ~IComponent ()=default
 Virtual destructor.
 

Private Attributes

uint32_t _parentEntityId
 Entity to orbit around.
 
float _orbitRadius
 Distance from parent (in pixels)
 
float _orbitSpeed
 Angular velocity (rad/s)
 
float _currentAngle
 Current orbital angle (radians)
 
int _damage
 Damage dealt on contact.
 
bool _blocksProjectiles
 Whether it blocks enemy projectiles.
 

Detailed Description

Component for entities that orbit around a parent entity (like drones in Isaac).

Defines orbital movement around a parent entity (typically a player). The module rotates at a fixed radius and speed, blocking projectiles and damaging enemies on contact.

Definition at line 22 of file OrbitalModule.hpp.

Constructor & Destructor Documentation

◆ OrbitalModule()

ecs::OrbitalModule::OrbitalModule ( uint32_t  parentEntityId,
float  orbitRadius,
float  orbitSpeed,
float  startAngle = 0.0f,
int  damage = 10 
)
inline

Constructor with all orbital parameters.

Parameters
parentEntityIdID of the entity to orbit around
orbitRadiusDistance from parent entity center
orbitSpeedAngular velocity in radians per second
startAngleInitial angle in radians (default: 0)
damageDamage dealt on contact with enemies

Definition at line 32 of file OrbitalModule.hpp.

◆ ~OrbitalModule()

ecs::OrbitalModule::~OrbitalModule ( )
overridedefault

Member Function Documentation

◆ blocksProjectiles()

bool ecs::OrbitalModule::blocksProjectiles ( ) const
inline

Check if blocks projectiles.

Returns
bool True if blocks enemy projectiles.

Definition at line 77 of file OrbitalModule.hpp.

References _blocksProjectiles.

◆ getCurrentAngle()

float ecs::OrbitalModule::getCurrentAngle ( ) const
inline

Get current angle.

Returns
float Current angle in radians.

Definition at line 65 of file OrbitalModule.hpp.

References _currentAngle.

Referenced by ecs::OrbitalSystem::updateOrbitalPosition().

◆ getDamage()

int ecs::OrbitalModule::getDamage ( ) const
inline

Get contact damage.

Returns
int Damage dealt to enemies.

Definition at line 71 of file OrbitalModule.hpp.

References _damage.

◆ getOrbitRadius()

float ecs::OrbitalModule::getOrbitRadius ( ) const
inline

Get orbit radius.

Returns
float Distance from parent center.

Definition at line 53 of file OrbitalModule.hpp.

References _orbitRadius.

Referenced by ecs::OrbitalSystem::updateOrbitalPosition().

◆ getOrbitSpeed()

float ecs::OrbitalModule::getOrbitSpeed ( ) const
inline

Get orbit speed.

Returns
float Angular velocity in rad/s.

Definition at line 59 of file OrbitalModule.hpp.

References _orbitSpeed.

Referenced by ecs::OrbitalSystem::updateOrbitalPosition().

◆ getParentEntityId()

uint32_t ecs::OrbitalModule::getParentEntityId ( ) const
inline

Get parent entity ID.

Returns
uint32_t Entity ID to orbit around.

Definition at line 47 of file OrbitalModule.hpp.

References _parentEntityId.

Referenced by ecs::OrbitalSystem::updateOrbitalPosition().

◆ getType()

ComponentType ecs::OrbitalModule::getType ( ) const
inlineoverridevirtual

Get the component type ID.

Returns
ComponentType Unique ID for OrbitalModule component.

Implements ecs::IComponent.

Definition at line 119 of file OrbitalModule.hpp.

◆ setBlocksProjectiles()

void ecs::OrbitalModule::setBlocksProjectiles ( bool  blocks)
inline

Set projectile blocking status.

Parameters
blocksTrue to block projectiles

Definition at line 113 of file OrbitalModule.hpp.

References _blocksProjectiles.

◆ setCurrentAngle()

void ecs::OrbitalModule::setCurrentAngle ( float  angle)
inline

Set current angle.

Parameters
angleNew angle in radians

Definition at line 101 of file OrbitalModule.hpp.

References _currentAngle.

Referenced by ecs::OrbitalSystem::updateOrbitalPosition().

◆ setDamage()

void ecs::OrbitalModule::setDamage ( int  damage)
inline

Set contact damage.

Parameters
damageNew damage value

Definition at line 107 of file OrbitalModule.hpp.

References _damage.

◆ setOrbitRadius()

void ecs::OrbitalModule::setOrbitRadius ( float  orbitRadius)
inline

Set orbit radius.

Parameters
orbitRadiusNew orbit radius

Definition at line 89 of file OrbitalModule.hpp.

References _orbitRadius.

◆ setOrbitSpeed()

void ecs::OrbitalModule::setOrbitSpeed ( float  orbitSpeed)
inline

Set orbit speed.

Parameters
orbitSpeedNew angular velocity

Definition at line 95 of file OrbitalModule.hpp.

References _orbitSpeed.

◆ setParentEntityId()

void ecs::OrbitalModule::setParentEntityId ( uint32_t  parentEntityId)
inline

Set parent entity ID.

Parameters
parentEntityIdNew parent entity ID

Definition at line 83 of file OrbitalModule.hpp.

References _parentEntityId.

Member Data Documentation

◆ _blocksProjectiles

bool ecs::OrbitalModule::_blocksProjectiles
private

Whether it blocks enemy projectiles.

Definition at line 127 of file OrbitalModule.hpp.

Referenced by blocksProjectiles(), and setBlocksProjectiles().

◆ _currentAngle

float ecs::OrbitalModule::_currentAngle
private

Current orbital angle (radians)

Definition at line 125 of file OrbitalModule.hpp.

Referenced by getCurrentAngle(), and setCurrentAngle().

◆ _damage

int ecs::OrbitalModule::_damage
private

Damage dealt on contact.

Definition at line 126 of file OrbitalModule.hpp.

Referenced by getDamage(), and setDamage().

◆ _orbitRadius

float ecs::OrbitalModule::_orbitRadius
private

Distance from parent (in pixels)

Definition at line 123 of file OrbitalModule.hpp.

Referenced by getOrbitRadius(), and setOrbitRadius().

◆ _orbitSpeed

float ecs::OrbitalModule::_orbitSpeed
private

Angular velocity (rad/s)

Definition at line 124 of file OrbitalModule.hpp.

Referenced by getOrbitSpeed(), and setOrbitSpeed().

◆ _parentEntityId

uint32_t ecs::OrbitalModule::_parentEntityId
private

Entity to orbit around.

Definition at line 122 of file OrbitalModule.hpp.

Referenced by getParentEntityId(), and setParentEntityId().


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