- Timestamp:
- Oct 30, 2017, 4:04:29 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids/Asteroids.cc
r11506 r11516 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Florian Zinggeler 24 * Co-authors: 25 * ... 26 * 27 */ 28 29 /** 30 @file Invader.cc 31 @brief Implementation of the Invader class. 32 */ 33 1 34 #include "Asteroids.h" 35 #include "Highscore.h" 36 #include "core/CoreIncludes.h" 37 #include "core/EventIncludes.h" 38 #include "core/command/Executor.h" 39 #include "core/config/ConfigValueIncludes.h" 40 41 #include "gamestates/GSLevel.h" 42 #include "chat/ChatManager.h" 43 44 // ! HACK 45 #include "infos/PlayerInfo.h" 46 47 #include "AsteroidsCenterPoint.h" 48 #include "AsteroidsShip.h" 49 50 #include "core/command/ConsoleCommand.h" 51 #include "worldentities/ExplosionPart.h" 2 52 3 53 namespace orxonox 4 54 { 5 55 RegisterUnloadableClass(Asteroids); 6 56 7 Asteroids::Asteroids(Context* context) : Deathmatch(context) 8 { 9 level = 1; 10 this->numberOfBots = 0; 11 } 57 Asteroids::Asteroids(Context* context) : Deathmatch(context) 58 { 59 RegisterObject(Asteroids); 60 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 61 this->center_ = nullptr; 62 bEndGame = false; 63 lives = 3; 64 point = 0; 12 65 13 void Asteroids::spawnAsteroid(); 66 } 14 67 15 void Asteroids::setCenterpoint(InvaderCenterPoint* center) 68 69 AsteroidsShip* Asteroids::getPlayer() 70 { 71 if (player == nullptr) 72 { 73 for (Asteroids* ship : ObjectList<AsteroidsShip>()) 74 player = ship; 75 } 76 return player; 77 } 78 79 80 void Asteroids::setCenterpoint(AsteroidsCenterPoint* center) 16 81 { 17 82 this->center_ = center; 18 83 } 19 84 20 void Asteroids::start(); 21 void Asteroids::end(); 22 85 void Asteroids::costLife() 86 { 87 lives = 0; 88 }; 89 90 void Asteroids::start() 91 { 92 // Set variable to temporarily force the player to spawn. 93 this->bForceSpawn_ = true; 94 95 if (this->center_ == nullptr) // abandon mission! 96 { 97 orxout(internal_error) << "Invader: No Centerpoint specified." << endl; 98 GSLevel::startMainMenu(); 99 return; 100 } 101 // Call start for the parent class. 102 Deathmatch::start(); 103 } 104 105 void Asteroids::addPoints(int numPoints) 106 { 107 if (!bEndGame) 108 { 109 point += numPoints; 110 } 111 } 112 113 void Asteroids::end() 114 { 115 // DON'T CALL THIS! 116 // Deathmatch::end(); 117 // It will misteriously crash the game! 118 // Instead startMainMenu, this won't crash. 119 GSLevel::startMainMenu(); 120 } 23 121 }
Note: See TracChangeset
for help on using the changeset viewer.