| [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 |  | 
|---|
 | 29 |         this->setCollisionType(WorldEntity::Dynamic); | 
|---|
| [10172] | 30 |         //needed to keep track of the PlayerStats coded in TowerDefense.h | 
|---|
| [10159] | 31 |         this->td = orxonox_cast<TowerDefense*>(this->getGametype().get()); | 
|---|
| [10109] | 32 |  | 
|---|
 | 33 |     } | 
|---|
| [10172] | 34 |     //add credit if enemy is destroyed | 
|---|
 | 35 |     TowerDefenseEnemy::~TowerDefenseEnemy(){ | 
|---|
| [10246] | 36 |         this->td->addCredit(1); | 
|---|
| [10172] | 37 |     } | 
|---|
| [10109] | 38 |  | 
|---|
| [10123] | 39 |     void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord) | 
|---|
| [10109] | 40 |     { | 
|---|
| [10246] | 41 |         this->Waypointsvector_.push_back(coord); | 
|---|
| [10109] | 42 |     } | 
|---|
| [10132] | 43 |  | 
|---|
 | 44 |  | 
|---|
 | 45 |     void TowerDefenseEnemy::tick(float dt) | 
|---|
 | 46 |     { | 
|---|
 | 47 |         SUPER(TowerDefenseEnemy, tick, dt); | 
|---|
 | 48 |     } | 
|---|
 | 49 |  | 
|---|
| [10123] | 50 | /* | 
|---|
| [10109] | 51 |     void TowerDefenseEnemy::popWaypoint() | 
|---|
 | 52 |     { | 
|---|
| [10246] | 53 |         if(Waypointsvector_.size()>0) | 
|---|
 | 54 |             Waypointsvector_.pop_back(); | 
|---|
| [10109] | 55 |     } | 
|---|
 | 56 |  | 
|---|
 | 57 |     TDCoordinate TowerDefenseEnemy::peekWaypoint() | 
|---|
 | 58 |     { | 
|---|
| [10246] | 59 |         if(Waypointsvector_.size()<=0){ | 
|---|
 | 60 |             TDCoordinate* coord = TDCoordinate(-1,-1); | 
|---|
 | 61 |             return coord; | 
|---|
 | 62 |         }else{ | 
|---|
 | 63 |             return Waypointsvector_.at(Waypointsvector_.size()-1); | 
|---|
| [10109] | 64 |  | 
|---|
| [10246] | 65 |         } | 
|---|
| [10109] | 66 |  | 
|---|
 | 67 |  | 
|---|
 | 68 |     } | 
|---|
| [10123] | 69 | */ | 
|---|
| [10126] | 70 |  | 
|---|
| [10109] | 71 | } | 
|---|