Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
DeathBehavior Class Reference

Handles the death animation for a player. More...

#include <DeathBehavior.hpp>

+ Inheritance diagram for DeathBehavior:
+ Collaboration diagram for DeathBehavior:

Public Member Functions

 DeathBehavior (VisualState &visual, float server_tick_rate)
 
void update (float dt) override
 
bool isDone () const override
 Returns true when the behavior has completed and can be removed.
 
float getDuration () const override
 Total duration of this behavior in seconds.
 
float minDuration () const override
 Minimum duration below which this behavior is skipped entirely.
 
- Public Member Functions inherited from ADrawableBehavior
const std::vector< Particle > & getParticles () const
 
const std::vector< LineSegment > & getLines () const
 
- Public Member Functions inherited from IBehavior
virtual ~IBehavior ()=default
 

Private Member Functions

void _spawnParticles ()
 

Private Attributes

VisualState_visual
 
float _duration
 
float _elapsed = 0.0f
 
bool _spawned = false
 

Additional Inherited Members

- Protected Attributes inherited from ADrawableBehavior
std::vector< Particle_particles
 
std::vector< LineSegment_lines
 

Detailed Description

Handles the death animation for a player.

Definition at line 9 of file DeathBehavior.hpp.

Constructor & Destructor Documentation

◆ DeathBehavior()

DeathBehavior::DeathBehavior ( VisualState visual,
float  server_tick_rate 
)

Definition at line 8 of file DeathBehavior.cpp.

Member Function Documentation

◆ _spawnParticles()

void DeathBehavior::_spawnParticles ( )
private

Definition at line 13 of file DeathBehavior.cpp.

References ADrawableBehavior::_particles, _visual, Particle::active, Particle::alpha, Particle::color, Particle::delay, PARTICLE_COUNT, Particle::pos, VisualState::pos, Particle::size, and Particle::vel.

Referenced by update().

+ Here is the caller graph for this function:

◆ getDuration()

float DeathBehavior::getDuration ( ) const
inlineoverridevirtual

Total duration of this behavior in seconds.

Implements IBehavior.

Definition at line 15 of file DeathBehavior.hpp.

References _duration.

◆ isDone()

bool DeathBehavior::isDone ( ) const
overridevirtual

Returns true when the behavior has completed and can be removed.

Implements IBehavior.

Definition at line 58 of file DeathBehavior.cpp.

References _duration, and _elapsed.

◆ minDuration()

float DeathBehavior::minDuration ( ) const
inlineoverridevirtual

Minimum duration below which this behavior is skipped entirely.

Implements IBehavior.

Definition at line 16 of file DeathBehavior.hpp.

◆ update()

void DeathBehavior::update ( float  dt)
overridevirtual

Implements IBehavior.

Definition at line 35 of file DeathBehavior.cpp.

References _duration, _elapsed, ADrawableBehavior::_particles, _spawned, _spawnParticles(), _visual, and VisualState::scale.

+ Here is the call graph for this function:

Member Data Documentation

◆ _duration

float DeathBehavior::_duration
private

Definition at line 22 of file DeathBehavior.hpp.

Referenced by getDuration(), isDone(), and update().

◆ _elapsed

float DeathBehavior::_elapsed = 0.0f
private

Definition at line 23 of file DeathBehavior.hpp.

Referenced by isDone(), and update().

◆ _spawned

bool DeathBehavior::_spawned = false
private

Definition at line 24 of file DeathBehavior.hpp.

Referenced by update().

◆ _visual

VisualState& DeathBehavior::_visual
private

Definition at line 21 of file DeathBehavior.hpp.

Referenced by _spawnParticles(), and update().


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