10#include "../../Components/IComponent.hpp"
11#include "../../Components/PendingDestroy.hpp"
21 for (
auto entityId : entities) {
41 LOG_DEBUG(
"[OrbitalSystem] Parent entity ", parentId,
" destroyed, removing orbital module ",
55 const float TWO_PI = 2.0f * 3.14159265359f;
56 if (newAngle >= TWO_PI) {
58 }
else if (newAngle < 0.0f) {
66 float newX = parentPos.x + radius * std::cos(newAngle);
67 float newY = parentPos.y + radius * std::sin(newAngle);
73 return (1ULL << getComponentType<OrbitalModule>()) | (1ULL << getComponentType<Transform>());
Component for entities that orbit around a parent entity (like drones in Isaac).
void setCurrentAngle(float angle)
Set current angle.
uint32_t getParentEntityId() const
Get parent entity ID.
float getOrbitRadius() const
Get orbit radius.
float getCurrentAngle() const
Get current angle.
float getOrbitSpeed() const
Get orbit speed.
void update(Registry ®istry, float deltaTime) override
Updates all orbital module positions.
void updateOrbitalPosition(Registry ®istry, Address moduleEntity, OrbitalModule &orbital, Transform &transform, float deltaTime)
Updates a single orbital module's position.
ComponentMask getComponentMask() const override
Gets the component mask for this system.
Marker component indicating entity should be destroyed.
Manages entities, their signatures and component type registrations.
std::vector< Address > getEntitiesWithMask(Signature requiredMask)
Get all entities matching a specific component mask.
T & getComponent(Address address)
Get a component from an entity.
bool hasComponent(Address address)
Check if an entity has a specific component.
void setComponent(Address address, const T &component)
Set/add a component to an entity with its data.
Maximum number of distinct component types supported by the Registry.
std::uint32_t Address
Type used to represent an entity address/ID.
std::uint64_t ComponentMask
Type alias for component bitmask.