- Timestamp:
- Jun 3, 2012, 6:05:24 PM (13 years ago)
- Location:
- code/branches/presentation2012merge/src/modules/towerdefense
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012merge/src/modules/towerdefense/CMakeLists.txt
r9271 r9272 5 5 TowerDefenseHUDController.cc 6 6 TowerDefensePlayerStats.cc 7 7 8 8 ) 9 9 … … 13 13 LINK_LIBRARIES 14 14 orxonox 15 15 overlays 16 16 SOURCE_FILES ${TOWERDEFENSE_SRC_FILES} 17 17 ) -
code/branches/presentation2012merge/src/modules/towerdefense/TDEnemy.h
r9271 r9272 13 13 14 14 private: 15 16 17 15 float health; 16 float speed; 17 float armour; 18 18 19 19 -
code/branches/presentation2012merge/src/modules/towerdefense/Tower.cc
r9271 r9272 17 17 { 18 18 CreateFactory(Tower); 19 19 20 20 /** 21 22 23 21 @brief 22 Constructor. Registers and initializes the object. 23 */ 24 24 Tower::Tower(BaseObject* creator) : Pawn(creator) 25 25 { … … 34 34 this->delay_ = false; 35 35 this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this))); 36 36 */ 37 37 } 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 38 39 void Tower::setOrientation(const Quaternion& orientation) 40 { 41 static int ori; 42 orxout() << "orientation " << ++ori << endl; 43 } 44 45 void Tower::rotateYaw(const Vector2& value) 46 { 47 static int yaw; 48 orxout() << "rotateYaw " << ++yaw << endl; 49 } 50 51 void Tower::rotatePitch(const Vector2& value) 52 { 53 static int pitch; 54 orxout() << "rotatePitch " << ++pitch << endl; 55 } 56 57 void Tower::rotateRoll(const Vector2& value) 58 { 59 static int roll; 60 orxout() << "rotateRoll" << ++roll << endl; 61 } 62 63 // This function is called whenever a player presses the up or the down key. 64 64 // You have to implement what happens when the up or the down key is pressed. 65 65 // value.x < 0 means: down key is pressed. … … 75 75 76 76 /** 77 78 79 80 81 82 77 @brief 78 Overloaded the function to rotate the stone. 79 @param value 80 A vector whose first component is the angle by which to rotate. 81 */ 82 /* 83 83 void Tower::moveFrontBack(const Vector2& value) 84 84 { 85 85 //orxout() << "frontBack.x: " << value.x << endl; 86 86 } 87 88 87 */ 88 89 89 /** 90 91 92 93 94 95 90 @brief 91 Overloaded the function to steer the stone right and left 92 @param value 93 A vector whose first component is the direction in which we want to steer the stone. 94 */ 95 /* 96 96 void Tower::moveRightLeft(const Vector2& value) 97 97 { 98 99 98 //orxout() << "rightLeft.x: " << value.x << endl; 99 100 100 if(!this->delay_) 101 101 { … … 104 104 if(!this->tetris_->isValidMove(this, newPos)) 105 105 return; 106 106 107 107 this->setPosition(newPos); 108 108 this->delay_ = true; 109 109 this->delayTimer_.startTimer(); 110 110 } 111 111 } 112 112 */ 113 113 } -
code/branches/presentation2012merge/src/modules/towerdefense/Tower.h
r9271 r9272 10 10 @brief 11 11 See TowerDefenseReadme.txt for Information. 12 12 13 13 @ingroup TowerDefense 14 14 */ … … 20 20 #include "towerdefense/TowerDefensePrereqs.h" 21 21 #include "worldentities/pawns/SpaceShip.h" 22 22 23 23 24 24 namespace orxonox … … 26 26 class _TowerDefenseExport Tower : public Pawn 27 27 { 28 29 30 31 32 33 34 35 36 37 38 39 28 public: 29 Tower(BaseObject* creator); 30 virtual ~Tower() {}; 31 32 // Maybe later override these to move towers with cursor keys 33 /* 34 virtual void moveFrontBack(const Vector2& value); 35 virtual void moveRightLeft(const Vector2& value); 36 */ 37 38 // Overriding these to stop towers from spasing out 39 void setOrientation(const Quaternion& orientation); 40 40 virtual void rotateYaw(const Vector2& value); 41 41 virtual void rotatePitch(const Vector2& value); 42 42 virtual void rotateRoll(const Vector2& value); 43 44 45 46 47 43 44 void setGame(TowerDefense* towerdefense) 45 { assert(towerdefense); game_ = towerdefense; } 46 private: 47 TowerDefense* game_; 48 48 }; 49 49 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefense.cc
r9271 r9272 82 82 #include "worldentities/pawns/SpaceShip.h" 83 83 #include "controllers/WaypointController.h" 84 84 85 85 #include "graphics/Model.h" 86 86 #include "infos/PlayerInfo.h" 87 87 88 88 #include "chat/ChatManager.h" 89 89 … … 94 94 { 95 95 CreateUnloadableFactory(TowerDefense); 96 97 96 97 TowerDefense::TowerDefense(BaseObject* creator) : Deathmatch(creator) 98 98 { 99 99 RegisterObject(TowerDefense); 100 100 101 101 this->setHUDTemplate("TowerDefenseHUD"); 102 102 103 104 105 106 107 } 108 103 this->stats_ = new TowerDefensePlayerStats(); 104 105 /* Temporary hack to allow the player to add towers */ 106 this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) ); 107 } 108 109 109 TowerDefense::~TowerDefense() 110 110 { 111 111 /* Part of a temporary hack to allow the player to add towers */ 112 112 if (this->isInitialized()) 113 113 { … … 116 116 } 117 117 } 118 119 120 121 122 123 124 125 118 119 void TowerDefense::setCenterpoint(TowerDefenseCenterpoint *centerpoint) 120 { 121 orxout() << "Centerpoint now setting..." << endl; 122 this->center_ = centerpoint; 123 orxout() << "Centerpoint now set..." << endl; 124 } 125 126 126 void TowerDefense::start() 127 127 { 128 128 Deathmatch::start(); 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 } 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 for(std::vector<Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it) 206 207 208 209 210 211 212 213 214 215 216 129 130 const int kInitialTowerCount = 3; 131 Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}}; 132 133 for (int i = 0; i < kInitialTowerCount; i++) 134 { 135 Coordinate coordinate = initialTowerCoordinates[i]; 136 addTower(coordinate.x, coordinate.y); 137 } 138 139 ChatManager::message("Use the console command addTower x y to add towers"); 140 141 //TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player 142 } 143 144 void TowerDefense::end() 145 { 146 Deathmatch::end(); 147 148 ChatManager::message("Match is over"); 149 } 150 151 void TowerDefense::addTower(int x, int y) 152 { 153 const TowerCost towerCost = TDDefaultTowerCost; 154 155 if (!this->hasEnoughCreditForTower(towerCost)) 156 { 157 orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed."; 158 return; 159 } 160 161 if (this->towerExists(x,y)) 162 { 163 orxout() << "tower exists!!" << endl; 164 return; 165 } 166 167 /* 168 unsigned int width = this->center_->getWidth(); 169 unsigned int height = this->center_->getHeight(); 170 */ 171 172 int tileScale = (int) this->center_->getTileScale(); 173 174 if (x > 15 || y > 15 || x < 0 || y < 0) 175 { 176 //Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet) 177 orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl; 178 return; 179 } 180 181 orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl; 182 183 // Add tower to coordinatesStack 184 Coordinate newTowerCoordinates = {x, y}; 185 addedTowersCoordinates_.push_back(newTowerCoordinates); 186 187 // Reduce credit 188 this->stats_->buyTower(towerCost); 189 190 // Create tower 191 Tower* newTower = new Tower(this->center_); 192 newTower->addTemplate(this->center_->getTowerTemplate()); 193 194 newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75); 195 newTower->setGame(this); 196 } 197 198 bool TowerDefense::hasEnoughCreditForTower(TowerCost towerCost) 199 { 200 return ((this->stats_->getCredit()) >= towerCost); 201 } 202 203 bool TowerDefense::towerExists(int x, int y) 204 { 205 for(std::vector<Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it) 206 { 207 Coordinate currentCoordinates = (Coordinate) (*it); 208 if (currentCoordinates.x == x && currentCoordinates.y == y) 209 return true; 210 } 211 212 return false; 213 } 214 215 216 void TowerDefense::tick(float dt) 217 217 { 218 218 SUPER(TowerDefense, tick, dt); 219 219 } 220 221 // Function to test if we can add waypoints using code only. Doesn't work yet 222 223 // THE PROBLEM: WaypointController's getControllableEntity() returns null, so it won't track. How do we get the controlableEntity to NOT BE NULL??? 224 /* 225 void TowerDefense::addWaypointsAndFirstEnemy() 226 { 227 SpaceShip *newShip = new SpaceShip(this->center_); 228 newShip->addTemplate("spaceshipassff"); 229 230 WaypointController *newController = new WaypointController(newShip); 231 newController->setAccuracy(3); 232 233 Model *wayPoint1 = new Model(newController); 234 wayPoint1->setMeshSource("crate.mesh"); 235 wayPoint1->setPosition(7,-7,5); 236 wayPoint1->setScale(0.2); 237 238 Model *wayPoint2 = new Model(newController); 239 wayPoint2->setMeshSource("crate.mesh"); 240 wayPoint2->setPosition(7,7,5); 241 wayPoint2->setScale(0.2); 242 243 newController->addWaypoint(wayPoint1); 244 newController->addWaypoint(wayPoint2); 245 246 // The following line causes the game to crash 247 248 newShip->setController(newController); 249 // newController -> getPlayer() -> startControl(newShip); 250 newShip->setPosition(-7,-7,5); 251 newShip->setScale(0.1); 252 //newShip->addSpeed(1); 253 254 255 256 // this->center_->attach(newShip); 257 } 258 */ 259 /* 260 void TowerDefense::playerEntered(PlayerInfo* player) 261 { 262 Deathmatch::playerEntered(player); 263 264 const std::string& message = player->getName() + " entered the game"; 265 ChatManager::message(message); 266 } 267 268 bool TowerDefense::playerLeft(PlayerInfo* player) 269 { 270 bool valid_player = Deathmatch::playerLeft(player); 271 272 if (valid_player) 273 { 274 const std::string& message = player->getName() + " left the game"; 275 ChatManager::message(message); 276 } 277 278 return valid_player; 279 } 280 281 282 void TowerDefense::pawnKilled(Pawn* victim, Pawn* killer) 283 { 284 if (victim && victim->getPlayer()) 285 { 286 std::string message; 287 if (killer) 288 { 289 if (killer->getPlayer()) 290 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName(); 291 else 292 message = victim->getPlayer()->getName() + " was killed"; 293 } 294 else 295 message = victim->getPlayer()->getName() + " died"; 296 297 ChatManager::message(message); 298 } 299 300 Deathmatch::pawnKilled(victim, killer); 301 } 302 303 void TowerDefense::playerScored(PlayerInfo* player) 304 { 305 Gametype::playerScored(player); 306 307 }*/ 220 221 // Function to test if we can add waypoints using code only. Doesn't work yet 222 223 // THE PROBLEM: WaypointController's getControllableEntity() returns null, so it won't track. How do we get the controlableEntity to NOT BE NULL??? 224 /* 225 void TowerDefense::addWaypointsAndFirstEnemy() 226 { 227 SpaceShip *newShip = new SpaceShip(this->center_); 228 newShip->addTemplate("spaceshipassff"); 229 230 WaypointController *newController = new WaypointController(newShip); 231 newController->setAccuracy(3); 232 233 Model *wayPoint1 = new Model(newController); 234 wayPoint1->setMeshSource("crate.mesh"); 235 wayPoint1->setPosition(7,-7,5); 236 wayPoint1->setScale(0.2); 237 238 Model *wayPoint2 = new Model(newController); 239 wayPoint2->setMeshSource("crate.mesh"); 240 wayPoint2->setPosition(7,7,5); 241 wayPoint2->setScale(0.2); 242 243 newController->addWaypoint(wayPoint1); 244 newController->addWaypoint(wayPoint2); 245 246 // The following line causes the game to crash 247 248 newShip->setController(newController); 249 // newController -> getPlayer() -> startControl(newShip); 250 newShip->setPosition(-7,-7,5); 251 newShip->setScale(0.1); 252 //newShip->addSpeed(1); 253 254 255 256 // this->center_->attach(newShip); 257 } 258 */ 259 /* 260 void TowerDefense::playerEntered(PlayerInfo* player) 261 { 262 Deathmatch::playerEntered(player); 263 264 const std::string& message = player->getName() + " entered the game"; 265 ChatManager::message(message); 266 } 267 268 bool TowerDefense::playerLeft(PlayerInfo* player) 269 { 270 bool valid_player = Deathmatch::playerLeft(player); 271 272 if (valid_player) 273 { 274 const std::string& message = player->getName() + " left the game"; 275 ChatManager::message(message); 276 } 277 278 return valid_player; 279 } 280 281 282 void TowerDefense::pawnKilled(Pawn* victim, Pawn* killer) 283 { 284 if (victim && victim->getPlayer()) 285 { 286 std::string message; 287 if (killer) 288 { 289 if (killer->getPlayer()) 290 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName(); 291 else 292 message = victim->getPlayer()->getName() + " was killed"; 293 } 294 else 295 message = victim->getPlayer()->getName() + " died"; 296 297 ChatManager::message(message); 298 } 299 300 Deathmatch::pawnKilled(victim, killer); 301 } 302 303 void TowerDefense::playerScored(PlayerInfo* player) 304 { 305 Gametype::playerScored(player); 306 }*/ 308 307 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefense.h
r9271 r9272 26 26 * 27 27 */ 28 28 29 29 /** 30 31 32 33 30 @brief 31 GameType class for TowerDefense. See TowerDefenseReadme.txt for Information. 32 33 @ingroup TowerDefense 34 34 */ 35 35 36 36 37 37 #ifndef _TowerDefense_H__ … … 40 40 #include "towerdefense/TowerDefensePrereqs.h" 41 41 #include "gametypes/Deathmatch.h" 42 42 43 43 #include "TowerDefensePlayerStats.h" 44 44 45 45 namespace orxonox 46 46 { 47 47 class _TowerDefenseExport TowerDefense : public Deathmatch 48 48 { 49 public: 50 TowerDefense(BaseObject* creator); 51 virtual ~TowerDefense(); 52 53 virtual void start(); //<! The function is called when the gametype starts 54 virtual void end(); 55 virtual void tick(float dt); 56 //virtual void playerEntered(PlayerInfo* player); 57 //virtual bool playerLeft(PlayerInfo* player); 58 59 //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 60 //virtual void playerScored(PlayerInfo* player); 61 62 63 /* Called by TowerDefenseCenterpoint upon game start 64 The centerpoint is used to create towers 65 */ 66 void setCenterpoint(TowerDefenseCenterpoint *centerpoint); 67 68 /* Adds a tower at x, y in the playfield */ 69 void addTower(int x, int y); 70 71 /* Part of a temporary hack to allow the player to add towers */ 72 ConsoleCommand* dedicatedAddTower_; 73 74 //TODO: void spawnNewWave() 75 //TODO: create a timer which regularly calls the spawnNewWave function (time driven) 76 // or spawn a new wave when the old wave has been killed (event driven) 49 public: 50 TowerDefense(BaseObject* creator); 51 virtual ~TowerDefense(); 52 53 virtual void start(); //<! The function is called when the gametype starts 54 virtual void end(); 55 virtual void tick(float dt); 56 //virtual void playerEntered(PlayerInfo* player); 57 //virtual bool playerLeft(PlayerInfo* player); 58 59 //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 60 //virtual void playerScored(PlayerInfo* player); 77 61 78 62 79 private: 80 TowerDefenseCenterpoint *center_; 81 82 /* handles stats */ 83 TowerDefensePlayerStats *stats_; 84 bool hasEnoughCreditForTower(TowerCost towerCost); 85 86 bool towerExists(int x, int y); 87 88 typedef struct { 89 int x; 90 int y; 91 } Coordinate; 92 93 std::vector<Coordinate> addedTowersCoordinates_; 94 std::vector<Tower*> towers_; 63 /* Called by TowerDefenseCenterpoint upon game start 64 The centerpoint is used to create towers 65 */ 66 void setCenterpoint(TowerDefenseCenterpoint *centerpoint); 67 68 /* Adds a tower at x, y in the playfield */ 69 void addTower(int x, int y); 70 71 /* Part of a temporary hack to allow the player to add towers */ 72 ConsoleCommand* dedicatedAddTower_; 73 74 //TODO: void spawnNewWave() 75 //TODO: create a timer which regularly calls the spawnNewWave function (time driven) 76 // or spawn a new wave when the old wave has been killed (event driven) 77 78 79 private: 80 TowerDefenseCenterpoint *center_; 81 82 /* handles stats */ 83 TowerDefensePlayerStats *stats_; 84 bool hasEnoughCreditForTower(TowerCost towerCost); 85 86 bool towerExists(int x, int y); 87 88 typedef struct { 89 int x; 90 int y; 91 } Coordinate; 92 93 std::vector<Coordinate> addedTowersCoordinates_; 94 std::vector<Tower*> towers_; 95 95 }; 96 96 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefenseCenterpoint.cc
r9271 r9272 50 50 { 51 51 RegisterObject(TowerDefenseCenterpoint); 52 53 52 53 this->width_ = 15; 54 54 this->height_ = 15; 55 55 this->towerTemplate_ = ""; 56 56 57 57 //this->setCollisionType(Static); 58 58 59 59 this->checkGametype(); 60 60 61 61 } … … 71 71 XMLPortParam(TowerDefenseCenterpoint, "width", setWidth, getWidth, xmlelement, mode); 72 72 XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, getHeight, xmlelement, mode); 73 73 XMLPortParam(TowerDefenseCenterpoint, "tileScale", setTileScale, getTileScale, xmlelement, mode); 74 74 XMLPortParam(TowerDefenseCenterpoint, "towerTemplate", setTowerTemplate, getTowerTemplate, xmlelement, mode); 75 75 76 76 //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint, xmlelement, mode); 77 77 // This was copied and shightly modified from WaypointController.cc ; there are no getters and setters and no membervariable yet … … 100 100 void TowerDefenseCenterpoint::checkGametype() 101 101 { 102 102 if (this->getGametype() != NULL && this->getGametype()->isA(Class(TowerDefense))) 103 103 { 104 104 // Sets the centerpoint of the gametype. The gametype uses this to later spawn in towers, he needs the tower template stored in the center point 105 105 TowerDefense* towerDefenseGametype = orxonox_cast<TowerDefense*>(this->getGametype().get()); 106 106 towerDefenseGametype->setCenterpoint(this); -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefenseCenterpoint.h
r9271 r9272 54 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 55 virtual void changedGametype(); 56 56 57 57 /** 58 58 @brief The width and hight in number of tiles. Default is 15 for both. … … 60 60 void setWidth(unsigned int width) 61 61 { this->width_ = width; } 62 63 62 63 unsigned int getWidth(void) const 64 64 { return this->width_; } 65 65 66 66 void setHeight(unsigned int height) 67 67 { this->height_ = height; } 68 69 68 69 unsigned int getHeight(void) const 70 70 { return this->height_; } 71 72 73 74 75 76 77 78 79 80 71 72 /** 73 @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10) 74 */ 75 void setTileScale(unsigned int tileScale) 76 { this->tileScale_ = tileScale; } 77 78 unsigned int getTileScale(void) const 79 { return this->tileScale_; } 80 81 81 /** 82 82 @brief Set the template for the towers. … … 85 85 void setTowerTemplate(const std::string& templateName) 86 86 { this->towerTemplate_ = templateName; } 87 88 87 88 const std::string& getTowerTemplate(void) const 89 89 { return this->towerTemplate_; } 90 90 91 91 private: 92 92 void checkGametype(); 93 93 94 94 unsigned int width_; 95 95 unsigned int height_; 96 97 96 unsigned int tileScale_; 97 98 98 std::string towerTemplate_; 99 99 }; -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefenseHUDController.cc
r9271 r9272 25 25 * ... 26 26 */ 27 27 28 28 #include "TowerDefenseHUDController.h" 29 29 … … 35 35 namespace orxonox 36 36 { 37 38 37 CreateFactory(TowerDefenseHUDController); 38 39 39 TowerDefenseHUDController::TowerDefenseHUDController(BaseObject* creator) : OverlayText(creator) 40 41 42 43 44 45 46 47 40 { 41 RegisterObject(TowerDefenseHUDController); 42 } 43 44 TowerDefenseHUDController::~TowerDefenseHUDController() 45 { 46 47 } 48 48 49 49 void TowerDefenseHUDController::tick(float dt) 50 51 52 53 50 { 51 SUPER(TowerDefenseHUDController, tick, dt); 52 } 53 54 54 void TowerDefenseHUDController::XMLPort(Element& xmlelement, XMLPort::Mode mode) 55 56 57 58 55 { 56 SUPER(TowerDefenseHUDController, XMLPort, xmlelement, mode); 57 } 58 59 59 void TowerDefenseHUDController::changedOwner() 60 60 { 61 61 SUPER(TowerDefenseHUDController, changedOwner); 62 62 /* 63 63 if (this->getOwner() != NULL && this->getOwner()->getGametype()) 64 64 this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get()); 65 65 else 66 66 this->owner_ = 0; 67 67 */ 68 68 } 69 69 70 70 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefenseHUDController.h
r9271 r9272 26 26 * 27 27 */ 28 28 29 29 /** 30 31 32 33 30 @brief 31 This subclass of OverlayText is used to display the stats of the player in the HUD 32 33 @ingroup TowerDefense 34 34 */ 35 35 36 36 37 37 #ifndef _TowerDefenseHUDController_H__ … … 48 48 class _TowerDefenseExport TowerDefenseHUDController : public OverlayText, public Tickable 49 49 { 50 51 50 public: 51 TowerDefenseHUDController(BaseObject* creator); 52 52 virtual ~TowerDefenseHUDController(); 53 53 54 54 virtual void tick(float dt); 55 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 56 56 virtual void changedOwner(); 57 57 }; 58 58 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefensePlayerStats.cc
r9271 r9272 25 25 * ... 26 26 */ 27 27 28 28 #include "TowerDefensePlayerStats.h" 29 29 30 30 namespace orxonox 31 31 { 32 33 32 const int kDefaultCredit = 200; 33 34 34 TowerDefensePlayerStats::TowerDefensePlayerStats() 35 36 37 38 39 40 41 42 43 */ 35 { 36 this->credit_ = kDefaultCredit; 37 this->waveNumber_ = 0; 38 } 39 /* 40 TowerDefensePlayerStats::~TowerDefensePlayerStats() 41 { 42 } 43 */ 44 44 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefensePlayerStats.h
r9271 r9272 26 26 * 27 27 */ 28 28 29 29 /** 30 31 32 33 30 @brief 31 This manages the stats of the player. It is used by 'TowerDefense', the gametype 32 33 @ingroup TowerDefense 34 34 */ 35 35 36 36 37 37 #ifndef _TowerDefensePlayerStats_H__ … … 42 42 namespace orxonox 43 43 { 44 45 46 47 48 44 typedef enum _TowerCosts { 45 // Set to 0 for debug... 46 TDDefaultTowerCost = 0 47 } TowerCost; 48 49 49 class _TowerDefenseExport TowerDefensePlayerStats 50 50 { 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 51 public: 52 TowerDefensePlayerStats(); 53 54 inline int getCredit() 55 { return credit_; } 56 57 inline void setCredit(int credit) 58 { credit_ = credit; } 59 60 inline void buyTower(TowerCost cost) 61 { credit_ -= cost;} 62 63 inline int getWaveNumber() 64 { return waveNumber_; } 65 66 inline void didLoadNextWave() 67 { waveNumber_++; } 68 69 private: 70 int credit_; 71 int waveNumber_; 72 //int baseHealth_; 73 73 }; 74 74 } -
code/branches/presentation2012merge/src/modules/towerdefense/TowerDefensePrereqs.h
r9271 r9272 66 66 { 67 67 class TowerDefense; 68 68 class Tower; 69 69 class TowerDefenseCenterpoint; 70 71 70 class TowerDefenseHUDController; 71 class TowerDefensePlayerStats; 72 72 } 73 73
Note: See TracChangeset
for help on using the changeset viewer.