9 : _visual(visual), _duration(10.0f / server_tick_rate)
17 float theta = (
static_cast<float>(rand()) /
static_cast<float>(RAND_MAX)) * 2.0f * PI;
18 float phi = (
static_cast<float>(rand()) /
static_cast<float>(RAND_MAX)) * PI;
19 float speed = 0.8f + (
static_cast<float>(rand()) /
static_cast<float>(RAND_MAX)) * 1.2f;
23 p.
vel.x = speed * std::sin(phi) * std::cos(theta);
24 p.
vel.y = speed * std::cos(phi) * 0.6f + 0.4f;
25 p.
vel.z = speed * std::sin(phi) * std::sin(theta);
27 p.
size = 0.04f + (
static_cast<float>(rand()) /
static_cast<float>(RAND_MAX)) * 0.06f;
44 if (t > 1.0f) t = 1.0f;
46 float smooth = t * t * (3.0f - 2.0f * t);
50 p.pos.x += p.vel.x * dt;
51 p.pos.y += p.vel.y * dt;
52 p.pos.z += p.vel.z * dt;
static constexpr int PARTICLE_COUNT
std::vector< Particle > _particles
bool isDone() const override
Returns true when the behavior has completed and can be removed.
DeathBehavior(VisualState &visual, float server_tick_rate)
void update(float dt) override
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...