Last change
on this file since 12149 was
12018,
checked in by patricwi, 6 years ago
|
Merged TowerDefense
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Line | |
---|
1 | // |
---|
2 | // TowerDefenseEnemy.cc |
---|
3 | // Orxonox |
---|
4 | // |
---|
5 | // Created by Jonas Erb on 22.10.14. |
---|
6 | |
---|
7 | #include "TowerDefenseEnemy.h" |
---|
8 | #include "core/CoreIncludes.h" |
---|
9 | //#include "core/XMLPort.h" |
---|
10 | |
---|
11 | namespace orxonox |
---|
12 | { |
---|
13 | RegisterClass(TowerDefenseEnemy); |
---|
14 | |
---|
15 | /** |
---|
16 | @brief |
---|
17 | Constructor. Registers and initializes the object. |
---|
18 | */ |
---|
19 | TowerDefenseEnemy::TowerDefenseEnemy(Context* context) : SpaceShip(context) |
---|
20 | { |
---|
21 | RegisterObject(TowerDefenseEnemy); |
---|
22 | |
---|
23 | this->setCollisionType(WorldEntity::CollisionType::Dynamic); |
---|
24 | //needed to keep track of the PlayerStats coded in TowerDefense.h |
---|
25 | this->td = orxonox_cast<TowerDefense*>(this->getGametype()); |
---|
26 | once_ = false; |
---|
27 | } |
---|
28 | |
---|
29 | TowerDefenseEnemy::~TowerDefenseEnemy() |
---|
30 | { |
---|
31 | |
---|
32 | } |
---|
33 | |
---|
34 | WeakPtr<TowerDefense> TowerDefenseEnemy::getGame() |
---|
35 | { |
---|
36 | if (game == nullptr) |
---|
37 | { |
---|
38 | for (TowerDefense* towerDefense : ObjectList<TowerDefense>()) |
---|
39 | game = towerDefense; |
---|
40 | } |
---|
41 | return game; |
---|
42 | } |
---|
43 | |
---|
44 | void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) |
---|
45 | { |
---|
46 | Pawn::damage(damage, healthdamage, shielddamage, originator); |
---|
47 | |
---|
48 | if (getGame() && once_ == false && getHealth() <= 0) |
---|
49 | { |
---|
50 | |
---|
51 | getGame()->addCredit(1); |
---|
52 | once_ = true; |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.