|
Zappy GUI
C++ graphic client: renderer, camera, network
|
Ritual animation for players participating in an incantation. More...
#include <IncantationBehavior.hpp>
Inheritance diagram for IncantationBehavior:
Collaboration diagram for IncantationBehavior:Public Member Functions | |
| IncantationBehavior (VisualState &visual, Player &player, int playerIndex, int totalPlayers, float tileCenterX, float tileCenterZ, float tileSize, float serverTickRate) | |
| 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 Types | |
| enum class | Phase { SPREAD , HOLD , END } |
Private Member Functions | |
| void | _spawnParticles () |
| void | _updateParticles (float dt) |
Private Attributes | |
| VisualState & | _visual |
| Player & | _player |
| bool | _isParticleOwner |
| Phase | _phase = Phase::SPREAD |
| float | _elapsed = 0.0f |
| float | _elapsedEnd = 0.0f |
| float | _duration |
| Vector3 | _startPos |
| Vector3 | _slotPos |
| float | _startAngle |
| float | _targetFaceAngle |
| float | _savedAngle = 0.0f |
| bool | _angleSaved = false |
| Vector3 | _tileCenter |
| bool | _particlesSpawned = false |
Static Private Attributes | |
| static constexpr float | SPREAD_DURATION = 0.5f |
| static constexpr float | END_DURATION = 0.35f |
| static constexpr float | CIRCLE_RADIUS = 0.32f |
| static constexpr int | PARTICLE_COUNT = 12 |
Additional Inherited Members | |
Protected Attributes inherited from ADrawableBehavior | |
| std::vector< Particle > | _particles |
| std::vector< LineSegment > | _lines |
Ritual animation for players participating in an incantation.
Players spread to fixed circle slots around the tile center, face inward, and hold position while ethereal particles drift at the center. On end signal (success or failure), they rotate back and return to tile center.
Definition at line 15 of file IncantationBehavior.hpp.
|
strongprivate |
| Enumerator | |
|---|---|
| SPREAD | |
| HOLD | |
| END | |
Definition at line 31 of file IncantationBehavior.hpp.
| IncantationBehavior::IncantationBehavior | ( | VisualState & | visual, |
| Player & | player, | ||
| int | playerIndex, | ||
| int | totalPlayers, | ||
| float | tileCenterX, | ||
| float | tileCenterZ, | ||
| float | tileSize, | ||
| float | serverTickRate | ||
| ) |
Definition at line 28 of file IncantationBehavior.cpp.
References _slotPos, _startAngle, _startPos, _targetFaceAngle, _tileCenter, VisualState::angle, CIRCLE_RADIUS, and VisualState::pos.
|
private |
Definition at line 53 of file IncantationBehavior.cpp.
References ADrawableBehavior::_particles, _particlesSpawned, _tileCenter, Particle::active, Particle::alpha, Particle::color, Particle::delay, PARTICLE_COUNT, Particle::pos, Particle::size, and Particle::vel.
Referenced by update().
Here is the caller graph for this function:
|
private |
Definition at line 82 of file IncantationBehavior.cpp.
References _elapsed, ADrawableBehavior::_particles, and _tileCenter.
Referenced by update().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Total duration of this behavior in seconds.
Implements IBehavior.
Definition at line 22 of file IncantationBehavior.hpp.
References _duration.
|
overridevirtual |
Returns true when the behavior has completed and can be removed.
Implements IBehavior.
Definition at line 158 of file IncantationBehavior.cpp.
References _elapsedEnd, ADrawableBehavior::_particles, _phase, END, and END_DURATION.
|
inlineoverridevirtual |
Minimum duration below which this behavior is skipped entirely.
Implements IBehavior.
Definition at line 23 of file IncantationBehavior.hpp.
|
overridevirtual |
Implements IBehavior.
Definition at line 111 of file IncantationBehavior.cpp.
References _angleSaved, _elapsed, _elapsedEnd, _isParticleOwner, ADrawableBehavior::_particles, _particlesSpawned, _phase, _player, _savedAngle, _slotPos, _spawnParticles(), _startAngle, _startPos, _targetFaceAngle, _tileCenter, _updateParticles(), _visual, VisualState::angle, END, END_DURATION, HOLD, lerpAngle(), lerpv(), VisualState::pos, smoothstep(), SPREAD, and SPREAD_DURATION.
Here is the call graph for this function:
|
private |
Definition at line 50 of file IncantationBehavior.hpp.
Referenced by update().
|
private |
Definition at line 43 of file IncantationBehavior.hpp.
Referenced by getDuration().
|
private |
Definition at line 41 of file IncantationBehavior.hpp.
Referenced by _updateParticles(), and update().
|
private |
Definition at line 42 of file IncantationBehavior.hpp.
|
private |
Definition at line 38 of file IncantationBehavior.hpp.
Referenced by update().
|
private |
Definition at line 53 of file IncantationBehavior.hpp.
Referenced by _spawnParticles(), and update().
|
private |
Definition at line 40 of file IncantationBehavior.hpp.
|
private |
Definition at line 37 of file IncantationBehavior.hpp.
Referenced by update().
|
private |
Definition at line 49 of file IncantationBehavior.hpp.
Referenced by update().
|
private |
Definition at line 46 of file IncantationBehavior.hpp.
Referenced by IncantationBehavior(), and update().
|
private |
Definition at line 47 of file IncantationBehavior.hpp.
Referenced by IncantationBehavior(), and update().
|
private |
Definition at line 45 of file IncantationBehavior.hpp.
Referenced by IncantationBehavior(), and update().
|
private |
Definition at line 48 of file IncantationBehavior.hpp.
Referenced by IncantationBehavior(), and update().
|
private |
Definition at line 51 of file IncantationBehavior.hpp.
Referenced by _spawnParticles(), _updateParticles(), IncantationBehavior(), and update().
|
private |
Definition at line 36 of file IncantationBehavior.hpp.
Referenced by update().
|
staticconstexprprivate |
Definition at line 28 of file IncantationBehavior.hpp.
Referenced by IncantationBehavior().
|
staticconstexprprivate |
Definition at line 27 of file IncantationBehavior.hpp.
|
staticconstexprprivate |
Definition at line 29 of file IncantationBehavior.hpp.
Referenced by _spawnParticles().
|
staticconstexprprivate |
Definition at line 26 of file IncantationBehavior.hpp.
Referenced by update().