]> git.tdb.fi Git - libs/game.git/blob - examples/bassteroids/source/damagesource.h
Make asteroids take damage when shot and eventually be destroyed
[libs/game.git] / examples / bassteroids / source / damagesource.h
1 #ifndef DAMAGESOURCE_H_
2 #define DAMAGESOURCE_H_
3
4 #include <msp/game/component.h>
5
6 struct DamageSourceSetup
7 {
8         unsigned amount = 1;
9         unsigned type = 0;
10 };
11
12 class DamageSource: public Msp::Game::Component
13 {
14 public:
15         using Setup = DamageSourceSetup;
16
17 private:
18         const Setup &setup;
19
20 public:
21         DamageSource(Msp::Game::Handle<Msp::Game::Entity>, const Setup &);
22
23         unsigned get_amount() const { return setup.amount; }
24         unsigned get_type() const { return setup.type; }
25 };
26
27 #endif