-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bunker.h
37 lines (27 loc) · 874 Bytes
/
Bunker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <memory>
using std::shared_ptr;
#include "ICollideable.h"
#include "RectF.h"
class BunkerPiece;
class Sprite;
// A bunker contains 8 sprites in this shape:
// ***
// ***
// * *
class Bunker : public ICollideable {
RectF bounds;
vector< shared_ptr<BunkerPiece> > pieces;
public:
Bunker( const RectF &initialBounds );
void update( float t );
void draw();
RectF getHitBox() const override { return bounds; }
Vector2f getCentroid() const override { return bounds.centroid(); }
inline string getName() const override { return makeString( "Bunker %s", bounds.toString().c_str() ); }
// Considered dead when it has no pieces left.
inline bool isDead() const { return pieces.empty(); }
bool checkPiecesHit( shared_ptr<ICollideable> o );
void onHit( ICollideable *o ) override;
void clearDead();
};