]> git.tdb.fi Git - libs/game.git/blob - examples/bassteroids/source/hittable.h
b548a38bbddff6b1628da4c7ff4a94a05702e286
[libs/game.git] / examples / bassteroids / source / hittable.h
1 #ifndef HITTABLE_H_
2 #define HITTABLE_H_
3
4 #include <msp/game/entity.h>
5 #include "damagesource.h"
6 #include "hitpoints.h"
7 #include "physicalentity.h"
8
9 struct HittableSetup
10 {
11         bool immortal = false;
12         bool damaging = false;
13         HitPointsSetup hits;
14         DamageSourceSetup damage;
15 };
16
17 class Hittable: public PhysicalEntity
18 {
19 public:
20         using Setup = HittableSetup;
21
22 private:
23         Msp::Game::Owned<HitPoints> hits;
24         Msp::Game::Owned<DamageSource> damage;
25
26 public:
27         Hittable(Msp::Game::Handle<Msp::Game::Entity>, const Setup &, const PhysicalSetup &,
28                 const Msp::Game::TransformValues & = Msp::Game::TransformValues());
29
30         Msp::Game::Handle<HitPoints> get_hitpoints() { return hits; }
31         Msp::Game::Handle<DamageSource> get_damage() { return damage; }
32 };
33
34 #endif