Changeset 8898
- Timestamp:
- Oct 19, 2011, 4:21:48 PM (13 years ago)
- Location:
- code/branches/spaceraceTwo/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc
r8858 r8898 34 34 #include "util/Math.h" 35 35 36 #include "items/Engine.h" 37 36 38 namespace orxonox 37 39 { … … 44 46 this->bTimeIsUp_ = false; 45 47 this->numberOfBots_ = 0; 48 46 49 } 50 51 // void SpaceRace::SetConfigValues(){ 52 //SUPER(Gametype,setConfigValues); 53 //this->Gametype::SetConfigValue(initialStartCountdown_, 3.0f);} 47 54 48 55 void SpaceRace::end() … … 81 88 82 89 void SpaceRace::start() 83 { 84 Gametype::start(); 85 90 { int i=0; 91 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 92 {this->maxSpeedBack_[i]=it->getMaxSpeedBack(); 93 this->maxSpeedFront_[i]=it->getMaxSpeedFront(); 94 this->maxSpeedLeftRight_[i]=it->getMaxSpeedLeftRight(); 95 this->maxSpeedUpDown_[i]=(it->getMaxSpeedUpDown()); 96 97 it->setMaxSpeedBack(0); 98 it->setMaxSpeedFront(0); 99 it->setMaxSpeedLeftRight(0); 100 it->setMaxSpeedUpDown(0); 101 102 i++; 103 } 104 //Gametype::start(); 105 this->addBots(this->numberOfBots_); 106 this->spawnPlayersIfRequested(); 107 108 109 Gametype::checkStart(); 110 111 i=0; 112 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 113 { 114 it->setMaxSpeedBack(this->maxSpeedBack_[i]); 115 it->setMaxSpeedFront(this->maxSpeedFront_[i]); 116 it->setMaxSpeedLeftRight(this->maxSpeedLeftRight_[i]); 117 it->setMaxSpeedUpDown(this->maxSpeedUpDown_[i]); 118 i++; 119 120 121 } 122 delete &this->maxSpeedBack_; 123 delete &this->maxSpeedFront_; 124 delete &this->maxSpeedLeftRight_; 125 delete &this->maxSpeedUpDown_; 86 126 std::string message("The match has started! Reach the check points as quickly as possible!"); 87 127 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 88 128 ChatManager::message(message); 129 89 130 } 131 132 void SpaceRace::tick(float dt) 133 {SUPER(SpaceRace,tick,dt); 134 135 136 //if(const_cast<GametypeInfo*>(this->getGametypeInfo())->isStartCountdownRunning()){ 137 //const_cast<GametypeInfo*>(this->getGametypeInfo())->start();} 138 } 139 90 140 91 141 void SpaceRace::newCheckpointReached() -
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.h
r8767 r8898 34 34 #include <set> 35 35 #include <string> 36 #include <vector> 36 37 37 38 #include <util/Clock.h> … … 57 58 virtual void start(); 58 59 virtual void end(); 59 60 60 61 virtual void newCheckpointReached(); 61 62 … … 66 67 inline void timeIsUp() 67 68 { this->bTimeIsUp_ = true;} 68 69 void tick(float dt); 69 70 protected: 70 71 71 72 private: 73 std::vector<float> maxSpeedBack_; std::vector<float> maxSpeedFront_; std::vector<float> maxSpeedLeftRight_; std::vector<float> maxSpeedUpDown_; 72 74 int checkpointsReached_; //The current number of check points reached by the player. 73 75 std::set<float> scores_; //The times of the players are saved in a set. -
code/branches/spaceraceTwo/src/orxonox/gametypes/Gametype.cc
r8858 r8898 123 123 if (this->gtinfo_->isStartCountdownRunning() && !this->gtinfo_->hasStarted()) 124 124 this->gtinfo_->countdownStartCountdown(dt); 125 125 126 126 if (!this->gtinfo_->hasStarted()) 127 127 { … … 129 129 { 130 130 // Inform the GametypeInfo that the player is ready to spawn. 131 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn()) 131 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn()){ 132 132 this->gtinfo_->playerReadyToSpawn(it->first); 133 } 134 135 this->checkStart(); 133 134 } 135 } 136 137 this->checkStart(); 136 138 } 137 139 else if (!this->gtinfo_->hasEnded()) 138 this->spawnDeadPlayersIfRequested();139 140 this->assignDefaultPawnsIfNeeded(); 140 { this->spawnDeadPlayersIfRequested(); 141 142 this->assignDefaultPawnsIfNeeded();} 141 143 } 142 144 -
code/branches/spaceraceTwo/src/orxonox/gametypes/Gametype.h
r8706 r8898 156 156 virtual void resetTimer(float t); 157 157 158 159 158 160 protected: 159 161 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; -
code/branches/spaceraceTwo/src/orxonox/infos/GametypeInfo.cc
r8858 r8898 71 71 this->bStarted_ = false; 72 72 this->bEnded_ = false; 73 this->startCountdown_ = 0.0f;73 this->startCountdown_ = 10.0f; 74 74 this->bStartCountdownRunning_ = false; 75 this->counter_ = 0;75 this->counter_ = 10; 76 76 this->spawned_ = false; 77 77 this->readyToSpawn_ = false;
Note: See TracChangeset
for help on using the changeset viewer.