[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 | |
---|
| 15 | #include "core/CoreIncludes.h" |
---|
| 16 | //#include "core/XMLPort.h" |
---|
| 17 | |
---|
| 18 | namespace orxonox |
---|
| 19 | { |
---|
| 20 | RegisterClass(TowerDefenseEnemy); |
---|
| 21 | |
---|
| 22 | /** |
---|
| 23 | @brief |
---|
| 24 | Constructor. Registers and initializes the object. |
---|
| 25 | */ |
---|
[10126] | 26 | TowerDefenseEnemy::TowerDefenseEnemy(Context* context) : SpaceShip(context) |
---|
[10109] | 27 | { |
---|
| 28 | RegisterObject(TowerDefenseEnemy); |
---|
| 29 | |
---|
| 30 | this->setCollisionType(WorldEntity::Dynamic); |
---|
| 31 | |
---|
| 32 | } |
---|
| 33 | |
---|
[10123] | 34 | void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord) |
---|
[10109] | 35 | { |
---|
[10126] | 36 | this->Waypointsvector_.push_back(coord); |
---|
[10109] | 37 | } |
---|
[10132] | 38 | |
---|
| 39 | |
---|
| 40 | void TowerDefenseEnemy::tick(float dt) |
---|
| 41 | { |
---|
| 42 | SUPER(TowerDefenseEnemy, tick, dt); |
---|
| 43 | |
---|
[10158] | 44 | //ArtificialController* controller = (ArtificialController*)this->getController(); |
---|
| 45 | Vector3 ship = this->getRVWorldPosition(); |
---|
| 46 | Vector3* endpoint = new Vector3(500, 700, 150); |
---|
| 47 | |
---|
| 48 | float distance = ship.distance(*endpoint); |
---|
| 49 | |
---|
| 50 | //orxout() << "distance" << distance << endl; |
---|
| 51 | if(distance <50){ |
---|
| 52 | orxout() << "ENEMY KILLED!!!!" << endl; |
---|
| 53 | this->destroy(); } |
---|
[10132] | 54 | } |
---|
| 55 | |
---|
[10123] | 56 | /* |
---|
[10109] | 57 | void TowerDefenseEnemy::popWaypoint() |
---|
| 58 | { |
---|
| 59 | if(Waypointsvector_.size()>0) |
---|
| 60 | Waypointsvector_.pop_back(); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | TDCoordinate TowerDefenseEnemy::peekWaypoint() |
---|
| 64 | { |
---|
| 65 | if(Waypointsvector_.size()<=0){ |
---|
[10123] | 66 | TDCoordinate* coord = TDCoordinate(-1,-1); |
---|
[10109] | 67 | return coord; |
---|
| 68 | }else{ |
---|
| 69 | return Waypointsvector_.at(Waypointsvector_.size()-1); |
---|
| 70 | |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | } |
---|
[10123] | 75 | */ |
---|
[10126] | 76 | |
---|
[10109] | 77 | } |
---|