|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
Despawns bullets that leave the play area. More...
#include <BulletCleanupSystem.hpp>
Public Member Functions | |
| BulletCleanupSystem (ecs::Registry ®istry, 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. | |
Despawns bullets that leave the play area.
Definition at line 27 of file BulletCleanupSystem.hpp.
| rtp::server::BulletCleanupSystem::BulletCleanupSystem | ( | ecs::Registry & | registry, |
| RoomSystem & | roomSystem, | ||
| NetworkSyncSystem & | networkSync | ||
| ) |
Constructor for BulletCleanupSystem.
| registry | Reference to the ECS registry |
| roomSystem | Reference to the RoomSystem |
| networkSync | Reference to the NetworkSyncSystem |
Definition at line 12 of file BulletCleanupSystem.cpp.
|
private |
Despawn an entity and notify players in the room.
| entity | The entity to despawn |
| roomId | The 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().
|
overridevirtual |
Update system logic for one frame.
| dt | Time elapsed since last update in seconds |
Implements rtp::ecs::ISystem.
Definition at line 65 of file BulletCleanupSystem.cpp.
References _maxX, _minX, _registry, rtp::net::Boss, rtp::net::BossShield, rtp::net::Bullet, rtp::net::ChargedBullet, despawn(), rtp::net::EnemyBullet, rtp::ecs::Registry::get(), rtp::net::PowerupHeal, rtp::net::PowerupSpeed, rtp::net::Scout, rtp::net::Tank, and rtp::ecs::components::EntityType::type.
|
private |
Right boundary for bullet despawn.
Definition at line 59 of file BulletCleanupSystem.hpp.
Referenced by update().
|
private |
Left boundary for bullet despawn.
Definition at line 58 of file BulletCleanupSystem.hpp.
Referenced by update().
|
private |
Reference to the NetworkSyncSystem.
Definition at line 56 of file BulletCleanupSystem.hpp.
Referenced by despawn().
|
private |
Reference to the ECS registry.
Definition at line 54 of file BulletCleanupSystem.hpp.
|
private |
Reference to the RoomSystem.
Definition at line 55 of file BulletCleanupSystem.hpp.
Referenced by despawn().