KlassischeKeplerKriege/game/state/explosion.hpp
2016-09-27 19:32:12 +02:00

32 lines
955 B
C++

#pragma once
#include <glm/vec2.hpp>
namespace game {
/**
* 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