KlassischeKeplerKriege/game/state/explosion.hpp

29 lines
827 B
C++
Raw Normal View History

#pragma once
/**
* Explosion: just an effect which looks good.
*/
class Explosion {
public:
enum class Kind {
MissileExplodesInSpace, // missile explode in free space
MissileAgainstPlanet, // explosion of missile when it hits a planet
MissileAgainstShip // bigger explosion: missile hits a ship which explodes with it
};
Explosion(const glm::vec2 &pos, Kind kind, float maxAge=1.0)
: position(pos), kind(kind), age(0.0), maxAge(maxAge)
{
}
const Kind kind; // kind of the explosion
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;
};
#endif