KlassischeKeplerKriege/game/state/explosion.hpp
2016-09-27 21:16:55 +02:00

33 lines
903 B
C++

#pragma once
#include <glm/vec2.hpp>
#include "util.hpp"
#include "missile_hit_type.hpp"
namespace game {
/**
* Explosion: just an effect which looks good.
*/
class Explosion {
public:
Explosion(const glm::vec2 &pos, Hit hit, float maxAge=1.0)
: hit(hit)
, position(pos)
, age(0.0)
, maxAge(maxAge * (1.0 + 0.1*util::randf_0_1()))
, maxRadius(0.05)
{
}
const Hit hit; // kind of the explosion depends on the hit type
const glm::vec2 position; // position where it starts
float age; // age (in seconsd) of the explosion
// age (in seconds) when the explosion is not visible
// anymore and will disappear afterwards
const float maxAge;
const float maxRadius; // current radius depends on time.
};
}