R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
OrbitalModule.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** RTYPE
4** File description:
5** OrbitalModule - Component for orbital companion modules
6*/
7
8#pragma once
9
10#include <cstdint>
11#include "IComponent.hpp"
12
13namespace ecs {
22 class OrbitalModule : public IComponent {
23 public:
32 OrbitalModule(uint32_t parentEntityId, float orbitRadius, float orbitSpeed, float startAngle = 0.0f,
33 int damage = 10)
34 : _parentEntityId(parentEntityId),
35 _orbitRadius(orbitRadius),
36 _orbitSpeed(orbitSpeed),
37 _currentAngle(startAngle),
38 _damage(damage),
39 _blocksProjectiles(true) {}
40
41 ~OrbitalModule() override = default;
42
47 uint32_t getParentEntityId() const { return _parentEntityId; }
48
53 float getOrbitRadius() const { return _orbitRadius; }
54
59 float getOrbitSpeed() const { return _orbitSpeed; }
60
65 float getCurrentAngle() const { return _currentAngle; }
66
71 int getDamage() const { return _damage; }
72
77 bool blocksProjectiles() const { return _blocksProjectiles; }
78
83 void setParentEntityId(uint32_t parentEntityId) { _parentEntityId = parentEntityId; }
84
89 void setOrbitRadius(float orbitRadius) { _orbitRadius = orbitRadius; }
90
95 void setOrbitSpeed(float orbitSpeed) { _orbitSpeed = orbitSpeed; }
96
101 void setCurrentAngle(float angle) { _currentAngle = angle; }
102
107 void setDamage(int damage) { _damage = damage; }
108
113 void setBlocksProjectiles(bool blocks) { _blocksProjectiles = blocks; }
114
119 ComponentType getType() const override { return getComponentType<OrbitalModule>(); }
120
121 private:
128 };
129} // namespace ecs
Base interface for all ECS components.
Component for entities that orbit around a parent entity (like drones in Isaac).
OrbitalModule(uint32_t parentEntityId, float orbitRadius, float orbitSpeed, float startAngle=0.0f, int damage=10)
Constructor with all orbital parameters.
float _orbitSpeed
Angular velocity (rad/s)
float _currentAngle
Current orbital angle (radians)
uint32_t _parentEntityId
Entity to orbit around.
void setParentEntityId(uint32_t parentEntityId)
Set parent entity ID.
bool _blocksProjectiles
Whether it blocks enemy projectiles.
void setCurrentAngle(float angle)
Set current angle.
uint32_t getParentEntityId() const
Get parent entity ID.
int _damage
Damage dealt on contact.
ComponentType getType() const override
Get the component type ID.
~OrbitalModule() override=default
float getOrbitRadius() const
Get orbit radius.
void setOrbitRadius(float orbitRadius)
Set orbit radius.
void setDamage(int damage)
Set contact damage.
bool blocksProjectiles() const
Check if blocks projectiles.
float getCurrentAngle() const
Get current angle.
float _orbitRadius
Distance from parent (in pixels)
void setOrbitSpeed(float orbitSpeed)
Set orbit speed.
void setBlocksProjectiles(bool blocks)
Set projectile blocking status.
int getDamage() const
Get contact damage.
float getOrbitSpeed() const
Get orbit speed.
Maximum number of distinct component types supported by the Registry.
Definition GameLogic.hpp:26
std::size_t ComponentType
Type alias for component identification.