Changeset 10624 for code/trunk/src/modules/dodgerace
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/modules/dodgerace/CMakeLists.txt
r10284 r10624 8 8 9 9 ORXONOX_ADD_LIBRARY(dodgerace 10 MODULE10 PLUGIN 11 11 FIND_HEADER_FILES 12 12 LINK_LIBRARIES -
code/trunk/src/modules/dodgerace/DodgeRace.cc
r10236 r10624 35 35 #include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header! 36 36 #include "DodgeRaceCube.h" 37 #include "core/CoreIncludes.h" 37 38 38 39 namespace orxonox … … 43 44 { 44 45 RegisterObject(DodgeRace); 45 init(); 46 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 47 this->center_ = 0; 48 49 this->setHUDTemplate("DodgeRaceHUD"); 50 } 51 52 void DodgeRace::init() 53 { 46 54 47 bEndGame = false; 55 48 lives = 1; … … 65 58 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this))); 66 59 comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this))); 60 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 61 this->center_ = 0; 62 63 this->setHUDTemplate("DodgeRaceHUD"); 67 64 } 68 65 … … 74 71 for (int i = 0; i < 7; i++) 75 72 { 76 WeakPtr<BigExplosion>chunk = new BigExplosion(this->center_->getContext());73 BigExplosion* chunk = new BigExplosion(this->center_->getContext()); 77 74 chunk->setPosition(Vector3(600, 0, 100.f * i - 300)); 78 75 chunk->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity() … … 90 87 if (getPlayer() != NULL) 91 88 { 92 //WeakPtr<DodgeRaceShip> ship = getPlayer();93 94 89 currentPosition = getPlayer()->getWorldPosition().x; 95 90 counter = counter + (currentPosition - lastPosition); … … 112 107 for(int i = 0; i<6; i++) 113 108 { 114 WeakPtr<DodgeRaceCube>cube = new DodgeRaceCube(this->center_->getContext());109 DodgeRaceCube* cube = new DodgeRaceCube(this->center_->getContext()); 115 110 cubeList.push_back(cube); 116 111 switch(pattern) … … 137 132 } 138 133 139 WeakPtr<DodgeRaceShip>DodgeRace::getPlayer()134 DodgeRaceShip* DodgeRace::getPlayer() 140 135 { 141 136 if (player == NULL) … … 168 163 { 169 164 orxout() << "start" << endl; 170 init();171 165 for(unsigned int i=0; i< cubeList.size();i++) 172 166 { … … 199 193 /* 200 194 orxout() << "prespawn" << endl; 201 init();202 195 for(int i=0; i< cubeList.size();i++) 203 196 { -
code/trunk/src/modules/dodgerace/DodgeRace.h
r10236 r10624 44 44 45 45 46 #include "core/CoreIncludes.h"47 46 #include "core/EventIncludes.h" 48 47 #include "core/command/Executor.h" … … 69 68 public: 70 69 DodgeRace(Context* context); 71 72 void init();73 70 74 71 virtual void start(); … … 106 103 Timer endGameTimer; 107 104 108 WeakPtr<DodgeRaceShip>getPlayer();105 DodgeRaceShip* getPlayer(); 109 106 WeakPtr<DodgeRaceShip> player; 110 107 std::vector<DodgeRaceCube*> cubeList; -
code/trunk/src/modules/dodgerace/DodgeRaceCenterPoint.cc
r10232 r10624 54 54 } 55 55 56 void DodgeRaceCenterPoint::changedGametype()57 {58 SUPER(DodgeRaceCenterPoint, changedGametype);59 60 // Check, whether it's still DodgeRace.61 this->checkGametype();62 }63 64 56 void DodgeRaceCenterPoint::checkGametype() 65 57 { 66 58 if (this->getGametype() != NULL && this->getGametype()->isA(Class(DodgeRace))) 67 59 { 68 DodgeRace* DodgeRaceGametype = orxonox_cast<DodgeRace*>(this->getGametype() .get());60 DodgeRace* DodgeRaceGametype = orxonox_cast<DodgeRace*>(this->getGametype()); 69 61 DodgeRaceGametype->setCenterpoint(this); 70 62 } -
code/trunk/src/modules/dodgerace/DodgeRaceCenterPoint.h
r10234 r10624 52 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 53 53 54 virtual void changedGametype(); //!< Is called when the gametype has changed.55 54 private: 56 55 void checkGametype(); -
code/trunk/src/modules/dodgerace/DodgeRaceCube.cc
r10236 r10624 33 33 #include "DodgeRaceCube.h" 34 34 #include "DodgeRace.h" 35 #include "core/CoreIncludes.h" 35 36 36 37 namespace orxonox -
code/trunk/src/modules/dodgerace/DodgeRaceHUDinfo.cc
r10236 r10624 82 82 if (this->getOwner() && this->getOwner()->getGametype()) 83 83 { 84 this->DodgeRaceGame = orxonox_cast<DodgeRace*>(this->getOwner()->getGametype() .get());84 this->DodgeRaceGame = orxonox_cast<DodgeRace*>(this->getOwner()->getGametype()); 85 85 } 86 86 else -
code/trunk/src/modules/dodgerace/DodgeRaceShip.cc
r10236 r10624 33 33 34 34 #include "DodgeRaceShip.h" 35 #include "core/CoreIncludes.h" 35 36 36 37 namespace orxonox … … 89 90 90 91 // Camera 91 WeakPtr<Camera>camera = this->getCamera();92 Camera* camera = this->getCamera(); 92 93 if (camera != NULL) 93 94 { … … 149 150 } 150 151 151 WeakPtr<DodgeRace>DodgeRaceShip::getGame()152 DodgeRace* DodgeRaceShip::getGame() 152 153 { 153 154 if (game == NULL) -
code/trunk/src/modules/dodgerace/DodgeRaceShip.h
r10284 r10624 38 38 #include "dodgerace/DodgeRacePrereqs.h" 39 39 40 #include "core/CoreIncludes.h"41 40 #include "core/XMLPort.h" 42 41 #include "worldentities/pawns/SpaceShip.h" … … 79 78 private: 80 79 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 81 WeakPtr<DodgeRace>getGame();80 DodgeRace* getGame(); 82 81 WeakPtr<DodgeRace> game; 83 82 WeakPtr<WorldEntity> lastEntity;
Note: See TracChangeset
for help on using the changeset viewer.