2016-09-27 16:23:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-09-27 17:26:16 +00:00
|
|
|
/**
|
|
|
|
* Explosion: just an effect which looks good.
|
|
|
|
*/
|
2016-09-27 16:23:58 +00:00
|
|
|
class Explosion {
|
|
|
|
public:
|
|
|
|
enum class Kind {
|
2016-09-27 17:26:16 +00:00
|
|
|
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
|
2016-09-27 16:23:58 +00:00
|
|
|
};
|
|
|
|
|
2016-09-27 17:26:16 +00:00
|
|
|
Explosion(const glm::vec2 &pos, Kind kind, float maxAge=1.0)
|
|
|
|
: position(pos), kind(kind), age(0.0), maxAge(maxAge)
|
|
|
|
{
|
|
|
|
}
|
2016-09-27 16:23:58 +00:00
|
|
|
|
2016-09-27 17:26:16 +00:00
|
|
|
const Kind kind; // kind of the explosion
|
|
|
|
const glm::vec2 position; // position where it starts
|
|
|
|
float age; // age (in seconsd) of the explosion
|
2016-09-27 16:23:58 +00:00
|
|
|
|
2016-09-27 17:26:16 +00:00
|
|
|
// age (in seconds) when the explosion is not visible
|
|
|
|
// anymore and will disappear afterwards
|
|
|
|
const float maxAge;
|
2016-09-27 16:23:58 +00:00
|
|
|
};
|
2016-09-27 17:26:16 +00:00
|
|
|
|
2016-09-27 16:23:58 +00:00
|
|
|
#endif
|