|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
Spawns bullets for enemies on the server. More...
#include <EnemyShootSystem.hpp>
Public Member Functions | |
| EnemyShootSystem (ecs::Registry ®istry, RoomSystem &roomSystem, NetworkSyncSystem &networkSync) | |
| Constructor for EnemyShootSystem. | |
| void | update (float dt) override |
| Update enemy shooting system logic for one frame. | |
Public Member Functions inherited from rtp::ecs::ISystem | |
| virtual | ~ISystem () noexcept=default |
Private Member Functions | |
| void | spawnBullet (const ecs::components::Transform &tf, const ecs::components::RoomId &roomId, bool isBoomerang=false, uint32_t shooterIndex=0) |
| Spawn a bullet entity at the given transform and room. | |
Private Attributes | |
| ecs::Registry & | _registry |
| Reference to the entity registry. | |
| RoomSystem & | _roomSystem |
| Reference to the RoomSystem. | |
| NetworkSyncSystem & | _networkSync |
| Reference to the NetworkSyncSystem. | |
| float | _bulletSpeed = -350.0f |
| Speed of the spawned bullets. | |
| float | _spawnOffsetX = -10.0f |
| X offset for bullet spawn position. | |
Spawns bullets for enemies on the server.
Definition at line 31 of file EnemyShootSystem.hpp.
| rtp::server::EnemyShootSystem::EnemyShootSystem | ( | ecs::Registry & | registry, |
| RoomSystem & | roomSystem, | ||
| NetworkSyncSystem & | networkSync | ||
| ) |
Constructor for EnemyShootSystem.
| registry | Reference to the entity registry |
| roomSystem | Reference to the RoomSystem |
| networkSync | Reference to the NetworkSyncSystem |
Definition at line 20 of file EnemyShootSystem.cpp.
|
private |
Spawn a bullet entity at the given transform and room.
| tf | Transform of the shooter entity |
| roomId | RoomId of the shooter entity |
| isBoomerang | Whether this is a boomerang projectile (Boss2) |
| shooterIndex | Index of the shooting entity (for boomerang tracking) |
Definition at line 76 of file EnemyShootSystem.cpp.
References _bulletSpeed, _networkSync, _registry, _roomSystem, _spawnOffsetX, rtp::ecs::Registry::add(), rtp::net::Boss2Bullet, rtp::net::EnemyBullet, rtp::net::EntitySpawn, rtp::log::error(), rtp::server::RoomSystem::getRoom(), rtp::ecs::components::RoomId::id, rtp::ecs::Entity::index(), rtp::server::Room::InGame, rtp::ecs::components::Boomerang::maxDistance, rtp::ecs::NullEntity, rtp::ecs::components::Boomerang::ownerIndex, rtp::ecs::components::Transform::position, rtp::ecs::components::Boomerang::returning, rtp::server::NetworkSyncSystem::sendPacketToSessions(), rtp::ecs::Registry::spawn(), rtp::ecs::components::Boomerang::startPos, rtp::net::TCP, rtp::Vec2< T >::x, and rtp::Vec2< T >::y.
Referenced by update().
|
overridevirtual |
Update enemy shooting system logic for one frame.
| dt | Time elapsed since last update in seconds |
Implements rtp::ecs::ISystem.
Definition at line 27 of file EnemyShootSystem.cpp.
References _registry, rtp::net::Boss, rtp::net::Boss2, rtp::net::BossShield, rtp::ecs::components::SimpleWeapon::lastShotTime, rtp::net::Scout, spawnBullet(), rtp::net::Tank, and rtp::ecs::Registry::zipView().
|
private |
Speed of the spawned bullets.
Definition at line 67 of file EnemyShootSystem.hpp.
Referenced by spawnBullet().
|
private |
Reference to the NetworkSyncSystem.
Definition at line 65 of file EnemyShootSystem.hpp.
Referenced by spawnBullet().
|
private |
Reference to the entity registry.
Definition at line 63 of file EnemyShootSystem.hpp.
Referenced by spawnBullet(), and update().
|
private |
Reference to the RoomSystem.
Definition at line 64 of file EnemyShootSystem.hpp.
Referenced by spawnBullet().
|
private |
X offset for bullet spawn position.
Definition at line 68 of file EnemyShootSystem.hpp.
Referenced by spawnBullet().