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

Expanding ring wave emitted from a broadcasting player, implemented as a circle of particles. More...

#include <BroadcastBehavior.hpp>

+ Inheritance diagram for BroadcastBehavior:
+ Collaboration diagram for BroadcastBehavior:

Classes

struct  ScatterSeed
 

Public Member Functions

 BroadcastBehavior (VisualState &visual, float server_tick_rate, float maxRadius, float mapWidth, float mapHeight)
 
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
 

Static Public Attributes

static constexpr int RING_POINTS = 64
 

Private Attributes

VisualState_visual
 
float _duration
 
float _elapsed = 0.0f
 
float _maxRadius
 
float _halfW
 
float _halfH
 
std::vector< ScatterSeed_seeds
 

Static Private Attributes

static constexpr int SCATTER_COUNT = 30
 

Additional Inherited Members

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

Detailed Description

Expanding ring wave emitted from a broadcasting player, implemented as a circle of particles.

Definition at line 12 of file BroadcastBehavior.hpp.

Constructor & Destructor Documentation

◆ BroadcastBehavior()

BroadcastBehavior::BroadcastBehavior ( VisualState visual,
float  server_tick_rate,
float  maxRadius,
float  mapWidth,
float  mapHeight 
)

Definition at line 12 of file BroadcastBehavior.cpp.

References ADrawableBehavior::_lines, ADrawableBehavior::_particles, _seeds, frand(), JITTER_RANGE, RING_POINTS, and SCATTER_COUNT.

+ Here is the call graph for this function:

Member Function Documentation

◆ getDuration()

float BroadcastBehavior::getDuration ( ) const
inlineoverridevirtual

Total duration of this behavior in seconds.

Implements IBehavior.

Definition at line 21 of file BroadcastBehavior.hpp.

References _duration.

◆ isDone()

bool BroadcastBehavior::isDone ( ) const
overridevirtual

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

Implements IBehavior.

Definition at line 92 of file BroadcastBehavior.cpp.

References _duration, _elapsed, ADrawableBehavior::_lines, and ADrawableBehavior::_particles.

◆ minDuration()

float BroadcastBehavior::minDuration ( ) const
inlineoverridevirtual

Minimum duration below which this behavior is skipped entirely.

Implements IBehavior.

Definition at line 22 of file BroadcastBehavior.hpp.

◆ update()

void BroadcastBehavior::update ( float  dt)
overridevirtual

Implements IBehavior.

Definition at line 55 of file BroadcastBehavior.cpp.

References _duration, _elapsed, _halfH, _halfW, ADrawableBehavior::_lines, _maxRadius, ADrawableBehavior::_particles, _seeds, _visual, BroadcastBehavior::ScatterSeed::alphaScale, BroadcastBehavior::ScatterSeed::angleOffset, frand(), VisualState::pos, BroadcastBehavior::ScatterSeed::radialJitter, RING_POINTS, RING_Y, SCATTER_COUNT, and wrapCoord().

+ Here is the call graph for this function:

Member Data Documentation

◆ _duration

float BroadcastBehavior::_duration
private

Definition at line 34 of file BroadcastBehavior.hpp.

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

◆ _elapsed

float BroadcastBehavior::_elapsed = 0.0f
private

Definition at line 35 of file BroadcastBehavior.hpp.

Referenced by isDone(), and update().

◆ _halfH

float BroadcastBehavior::_halfH
private

Definition at line 38 of file BroadcastBehavior.hpp.

Referenced by update().

◆ _halfW

float BroadcastBehavior::_halfW
private

Definition at line 37 of file BroadcastBehavior.hpp.

Referenced by update().

◆ _maxRadius

float BroadcastBehavior::_maxRadius
private

Definition at line 36 of file BroadcastBehavior.hpp.

Referenced by update().

◆ _seeds

std::vector<ScatterSeed> BroadcastBehavior::_seeds
private

Definition at line 39 of file BroadcastBehavior.hpp.

Referenced by BroadcastBehavior(), and update().

◆ _visual

VisualState& BroadcastBehavior::_visual
private

Definition at line 33 of file BroadcastBehavior.hpp.

Referenced by update().

◆ RING_POINTS

constexpr int BroadcastBehavior::RING_POINTS = 64
staticconstexpr

Definition at line 14 of file BroadcastBehavior.hpp.

Referenced by BroadcastBehavior(), and update().

◆ SCATTER_COUNT

constexpr int BroadcastBehavior::SCATTER_COUNT = 30
staticconstexprprivate

Definition at line 41 of file BroadcastBehavior.hpp.

Referenced by BroadcastBehavior(), and update().


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