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

Plays a rising particle burst when a player levels up. More...

#include <LevelUpBehavior.hpp>

+ Inheritance diagram for LevelUpBehavior:
+ Collaboration diagram for LevelUpBehavior:

Public Member Functions

 LevelUpBehavior (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

Plays a rising particle burst when a player levels up.

Definition at line 9 of file LevelUpBehavior.hpp.

Constructor & Destructor Documentation

◆ LevelUpBehavior()

LevelUpBehavior::LevelUpBehavior ( VisualState visual,
float  server_tick_rate 
)

Definition at line 8 of file LevelUpBehavior.cpp.

Member Function Documentation

◆ _spawnParticles()

void LevelUpBehavior::_spawnParticles ( )
private

Definition at line 13 of file LevelUpBehavior.cpp.

References _duration, 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 LevelUpBehavior::getDuration ( ) const
inlineoverridevirtual

Total duration of this behavior in seconds.

Implements IBehavior.

Definition at line 15 of file LevelUpBehavior.hpp.

References _duration.

◆ isDone()

bool LevelUpBehavior::isDone ( ) const
overridevirtual

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

Implements IBehavior.

Definition at line 71 of file LevelUpBehavior.cpp.

References _duration, _elapsed, and ADrawableBehavior::_particles.

◆ minDuration()

float LevelUpBehavior::minDuration ( ) const
inlineoverridevirtual

Minimum duration below which this behavior is skipped entirely.

Implements IBehavior.

Definition at line 16 of file LevelUpBehavior.hpp.

◆ update()

void LevelUpBehavior::update ( float  dt)
overridevirtual

Implements IBehavior.

Definition at line 44 of file LevelUpBehavior.cpp.

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

+ Here is the call graph for this function:

Member Data Documentation

◆ _duration

float LevelUpBehavior::_duration
private

Definition at line 22 of file LevelUpBehavior.hpp.

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

◆ _elapsed

float LevelUpBehavior::_elapsed = 0.0f
private

Definition at line 23 of file LevelUpBehavior.hpp.

Referenced by isDone(), and update().

◆ _spawned

bool LevelUpBehavior::_spawned = false
private

Definition at line 24 of file LevelUpBehavior.hpp.

Referenced by update().

◆ _visual

VisualState& LevelUpBehavior::_visual
private

Definition at line 21 of file LevelUpBehavior.hpp.

Referenced by _spawnParticles(), and update().


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