7static constexpr float RING_Y = 0.05f;
10static inline float frand() {
return static_cast<float>(rand()) /
static_cast<float>(RAND_MAX); }
13 float mapWidth,
float mapHeight)
15 _duration(7.0f / server_tick_rate),
16 _maxRadius(maxRadius),
17 _halfW(mapWidth / 2.0f),
18 _halfH(mapHeight / 2.0f)
28 s.alphaScale = 0.4f +
frand() * 0.6f;
29 s.sizeScale = 0.5f +
frand() * 1.0f;
31 unsigned char r =
static_cast<unsigned char>(
frand() * 60);
32 unsigned char g =
static_cast<unsigned char>(80 +
frand() * 140);
33 unsigned char b =
static_cast<unsigned char>(200 +
frand() * 55);
34 s.color = {r, g, b, 255};
49 float full = half * 2.0f;
50 val = fmodf(val + half, full);
51 if (val < 0.0f) val += full;
62 float alpha = t < 0.8f ? 1.0f : 1.0f - (t - 0.8f) / 0.2f;
65 Color ringColor = {30, 100, 255, 255};
73 Vector3 a = anchors[i];
75 bool seam = fabsf(a.x - b.x) >
_halfW || fabsf(a.z - b.z) >
_halfH;
76 _lines[i] = {a, b, ringColor, seam ? 0.0f : alpha};
static float wrapCoord(float val, float half)
static constexpr float RING_Y
static constexpr float JITTER_RANGE
std::vector< Particle > _particles
std::vector< LineSegment > _lines
void update(float dt) override
static constexpr int RING_POINTS
static constexpr int SCATTER_COUNT
bool isDone() const override
Returns true when the behavior has completed and can be removed.
BroadcastBehavior(VisualState &visual, float server_tick_rate, float maxRadius, float mapWidth, float mapHeight)
std::vector< ScatterSeed > _seeds
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...