Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
rtp::server::BulletCleanupSystem Class Reference

Despawns bullets that leave the play area. More...

#include <BulletCleanupSystem.hpp>

Inheritance diagram for rtp::server::BulletCleanupSystem:
Collaboration diagram for rtp::server::BulletCleanupSystem:

Public Member Functions

 BulletCleanupSystem (ecs::Registry &registry, RoomSystem &roomSystem, NetworkSyncSystem &networkSync)
 Constructor for BulletCleanupSystem.
 
void update (float dt) override
 Update system logic for one frame.
 
- Public Member Functions inherited from rtp::ecs::ISystem
virtual ~ISystem () noexcept=default
 

Private Member Functions

void despawn (const ecs::Entity &entity, uint32_t roomId)
 Despawn an entity and notify players in the room.
 

Private Attributes

ecs::Registry_registry
 Reference to the ECS registry.
 
RoomSystem_roomSystem
 Reference to the RoomSystem.
 
NetworkSyncSystem_networkSync
 Reference to the NetworkSyncSystem.
 
float _minX = -200.0f
 Left boundary for bullet despawn.
 
float _maxX = 1800.0f
 Right boundary for bullet despawn.
 

Detailed Description

Despawns bullets that leave the play area.

Definition at line 27 of file BulletCleanupSystem.hpp.

Constructor & Destructor Documentation

◆ BulletCleanupSystem()

rtp::server::BulletCleanupSystem::BulletCleanupSystem ( ecs::Registry registry,
RoomSystem roomSystem,
NetworkSyncSystem networkSync 
)

Constructor for BulletCleanupSystem.

Parameters
registryReference to the ECS registry
roomSystemReference to the RoomSystem
networkSyncReference to the NetworkSyncSystem

Definition at line 12 of file BulletCleanupSystem.cpp.

Member Function Documentation

◆ despawn()

void rtp::server::BulletCleanupSystem::despawn ( const ecs::Entity entity,
uint32_t  roomId 
)
private

Despawn an entity and notify players in the room.

Parameters
entityThe entity to despawn
roomIdThe ID of the room the entity belongs to

Definition at line 19 of file BulletCleanupSystem.cpp.

References _networkSync, _registry, _roomSystem, rtp::net::EntityDeath, rtp::ecs::Registry::get(), rtp::server::RoomSystem::getRoom(), rtp::ecs::Registry::kill(), rtp::net::EntityDeathPayload::netId, rtp::server::NetworkSyncSystem::sendPacketToSession(), and rtp::net::TCP.

Referenced by update().

◆ update()

void rtp::server::BulletCleanupSystem::update ( float  dt)
overridevirtual

Member Data Documentation

◆ _maxX

float rtp::server::BulletCleanupSystem::_maxX = 1800.0f
private

Right boundary for bullet despawn.

Definition at line 59 of file BulletCleanupSystem.hpp.

Referenced by update().

◆ _minX

float rtp::server::BulletCleanupSystem::_minX = -200.0f
private

Left boundary for bullet despawn.

Definition at line 58 of file BulletCleanupSystem.hpp.

Referenced by update().

◆ _networkSync

NetworkSyncSystem& rtp::server::BulletCleanupSystem::_networkSync
private

Reference to the NetworkSyncSystem.

Definition at line 56 of file BulletCleanupSystem.hpp.

Referenced by despawn().

◆ _registry

ecs::Registry& rtp::server::BulletCleanupSystem::_registry
private

Reference to the ECS registry.

Definition at line 54 of file BulletCleanupSystem.hpp.

Referenced by despawn(), and update().

◆ _roomSystem

RoomSystem& rtp::server::BulletCleanupSystem::_roomSystem
private

Reference to the RoomSystem.

Definition at line 55 of file BulletCleanupSystem.hpp.

Referenced by despawn().


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