125 float *overlapDist =
nullptr)
const;
174 void applyDamageToEnemy(std::uint32_t enemyId,
float damage, std::uint32_t attackerPlayerId = 0);
199 float *overlapDist)
const
203 float distance = std::sqrt(dx * dx + dy * dy);
204 float radiusSum = r1 + r2;
208 *overlapDist = radiusSum - distance;
211 return distance < radiusSum;
228 if (!transform || !hitbox)
231 x = transform->x + hitbox->offsetX;
232 y = transform->
y + hitbox->offsetY;
233 radius = hitbox->radius;
This file contains the component definitions.
Centralized entity lifecycle management system for R-Type server.
This file contains the entity definitions.
This file contains the interface for systems.
This file contains the Registry class declaration.
Abstract class for system.
Class for managing entities and their components.
T * getComponent(Entity e)
Server-authoritative collision detection and response system.
CollisionSystem(CollisionSystem &&)=delete
Deleted move constructor (non-movable)
bool getCollisionInfo(ecs::Entity entity, float &x, float &y, float &radius) const
Extract collision information from an entity.
size_t getCollisionCount() const
Get the number of collisions detected this frame.
void resetCollisionCount()
Reset the collision counter to zero.
~CollisionSystem() override=default
Destructor.
void handlePlayerPowerupCollision()
Handle collisions between players and powerups.
bool checkCircleCollision(float x1, float y1, float r1, float x2, float y2, float r2, float *overlapDist=nullptr) const
Check for circular collision between two entities.
size_t m_collisionCount
Counter for collisions detected this frame.
void handlePlayerProjectileEnemyCollision()
Handle collisions between player projectiles and enemies.
CollisionSystem & operator=(CollisionSystem &&)=delete
Deleted move assignment operator (non-movable)
void applyDamageToEnemy(std::uint32_t enemyId, float damage, std::uint32_t attackerPlayerId=0)
Apply damage to an enemy entity.
CollisionSystem(ecs::Registry ®istry, EntityManager &entityManager)
Constructor.
ecs::Registry & m_registry
ECS registry reference.
void applyDamageToPlayer(std::uint32_t playerId, float damage)
Apply damage to a player entity.
void update(ecs::Registry ®istry, float deltaTime) override
Update the collision system (called each frame)
CollisionSystem & operator=(const CollisionSystem &)=delete
Deleted copy assignment operator (non-copyable)
CollisionSystem(const CollisionSystem &)=delete
Deleted copy constructor (non-copyable)
void handleEnemyProjectilePlayerCollision()
Handle collisions between enemy projectiles and players.
EntityManager & m_entityManager
Entity manager reference for spawning/destruction.
void handlePlayerEnemyCollision()
Handle collisions between players and enemies (ramming)
Central entity lifecycle manager for the R-Type game server.
Data structure for storing collision information between two entities.
std::uint32_t entityId1
First entity ID in collision.
std::uint32_t entityId2
Second entity ID in collision.
float overlapDistance
Distance of overlap (radiusSum - distance)