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

Plays a scale-up animation when an egg is laid, with a particle burst at full size. More...

#include <ForkBehavior.hpp>

+ Inheritance diagram for ForkBehavior:
+ Collaboration diagram for ForkBehavior:

Public Member Functions

 ForkBehavior (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 _burstSpawned = false
 

Additional Inherited Members

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

Detailed Description

Plays a scale-up animation when an egg is laid, with a particle burst at full size.

Definition at line 9 of file ForkBehavior.hpp.

Constructor & Destructor Documentation

◆ ForkBehavior()

ForkBehavior::ForkBehavior ( VisualState visual,
float  server_tick_rate 
)

Definition at line 8 of file ForkBehavior.cpp.

References _visual, and VisualState::scale.

Member Function Documentation

◆ _spawnParticles()

void ForkBehavior::_spawnParticles ( )
private

Definition at line 14 of file ForkBehavior.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 ForkBehavior::getDuration ( ) const
inlineoverridevirtual

Total duration of this behavior in seconds.

Implements IBehavior.

Definition at line 15 of file ForkBehavior.hpp.

References _duration.

◆ isDone()

bool ForkBehavior::isDone ( ) const
overridevirtual

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

Implements IBehavior.

Definition at line 62 of file ForkBehavior.cpp.

References _duration, _elapsed, _visual, and VisualState::scale.

◆ minDuration()

float ForkBehavior::minDuration ( ) const
inlineoverridevirtual

Minimum duration below which this behavior is skipped entirely.

Implements IBehavior.

Definition at line 16 of file ForkBehavior.hpp.

◆ update()

void ForkBehavior::update ( float  dt)
overridevirtual

Implements IBehavior.

Definition at line 35 of file ForkBehavior.cpp.

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

+ Here is the call graph for this function:

Member Data Documentation

◆ _burstSpawned

bool ForkBehavior::_burstSpawned = false
private

Definition at line 24 of file ForkBehavior.hpp.

Referenced by update().

◆ _duration

float ForkBehavior::_duration
private

Definition at line 22 of file ForkBehavior.hpp.

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

◆ _elapsed

float ForkBehavior::_elapsed = 0.0f
private

Definition at line 23 of file ForkBehavior.hpp.

Referenced by isDone(), and update().

◆ _visual

VisualState& ForkBehavior::_visual
private

Definition at line 21 of file ForkBehavior.hpp.

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


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