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

System responsible for managing shield visual effects. More...

#include <ShieldSystem.hpp>

Inheritance diagram for rtp::client::ShieldSystem:
Collaboration diagram for rtp::client::ShieldSystem:

Public Member Functions

 ShieldSystem (ecs::Registry &registry)
 Construct a new Shield System.
 
void update (float dt) override
 Update shield animations and handle collision detection.
 
- Public Member Functions inherited from rtp::ecs::ISystem
virtual ~ISystem () noexcept=default
 

Private Attributes

ecs::Registry_registry
 

Detailed Description

System responsible for managing shield visual effects.

This system handles client-side shield visual behavior:

  • Animates shield pulsing effect (alpha oscillation between 150-255)
  • Detects AABB collisions between shielded players and enemy bullets
  • Removes shield visual when collision is detected

Note: Actual damage blocking is handled server-side by the Shield component. This system only manages the visual feedback on the client.

See also
rtp::ecs::components::ShieldVisual
rtp::ecs::components::Shield (server-side)

Definition at line 31 of file ShieldSystem.hpp.

Constructor & Destructor Documentation

◆ ShieldSystem()

rtp::client::ShieldSystem::ShieldSystem ( ecs::Registry registry)
explicit

Construct a new Shield System.

Parameters
registryThe ECS registry containing entities and components

Definition at line 20 of file ShieldSystem.cpp.

Member Function Documentation

◆ update()

void rtp::client::ShieldSystem::update ( float  dt)
overridevirtual

Update shield animations and handle collision detection.

Parameters
dtDelta time in seconds since last frame

Updates:

  1. ShieldVisual animation time for pulse effect
  2. Alpha value using sine wave (150 + sin(time * 3) * 105)
  3. Checks AABB collision with enemy bullets
  4. Removes shield visual on collision

Implements rtp::ecs::ISystem.

Definition at line 25 of file ShieldSystem.cpp.

References _registry, rtp::ecs::components::ShieldVisual::animationTime, rtp::net::EnemyBullet, rtp::ecs::Registry::get(), rtp::log::info(), rtp::ecs::Registry::kill(), rtp::net::Player, rtp::ecs::Registry::remove(), and rtp::ecs::components::BoundingBox::width.

Member Data Documentation

◆ _registry

ecs::Registry& rtp::client::ShieldSystem::_registry
private

Definition at line 52 of file ShieldSystem.hpp.

Referenced by update().


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