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