Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
IncantationBehavior.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "core/WorldState.hpp"
6#include "raylib.h"
7
16 public:
17 IncantationBehavior(VisualState& visual, Player& player, int playerIndex, int totalPlayers,
18 float tileCenterX, float tileCenterZ, float tileSize, float serverTickRate);
19
20 void update(float dt) override;
21 bool isDone() const override;
22 float getDuration() const override { return _duration; }
23 float minDuration() const override { return 0.0f; }
24
25 private:
26 static constexpr float SPREAD_DURATION = 0.5f;
27 static constexpr float END_DURATION = 0.35f;
28 static constexpr float CIRCLE_RADIUS = 0.32f; // fraction of tileSize
29 static constexpr int PARTICLE_COUNT = 12;
30
31 enum class Phase { SPREAD, HOLD, END };
32
33 void _spawnParticles();
34 void _updateParticles(float dt);
35
38 bool _isParticleOwner; // only playerIndex == 0 spawns center particles
39
41 float _elapsed = 0.0f;
42 float _elapsedEnd = 0.0f;
43 float _duration;
44
45 Vector3 _startPos;
46 Vector3 _slotPos;
49 float _savedAngle = 0.0f;
50 bool _angleSaved = false;
51 Vector3 _tileCenter;
52
53 bool _particlesSpawned = false;
54};
Base class for behaviors that produce visual drawables: sphere particles and line segments....
Ritual animation for players participating in an incantation.
void update(float dt) override
static constexpr float CIRCLE_RADIUS
static constexpr int PARTICLE_COUNT
float getDuration() const override
Total duration of this behavior in seconds.
void _updateParticles(float dt)
static constexpr float END_DURATION
float minDuration() const override
Minimum duration below which this behavior is skipped entirely.
bool isDone() const override
Returns true when the behavior has completed and can be removed.
static constexpr float SPREAD_DURATION
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...