- Timestamp:
- Dec 8, 2011, 6:07:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc
r8959 r8968 21 21 * 22 22 * Author: 23 * Mauro Salomon23 * Celine Eggenberger 24 24 * Co-authors: 25 25 * ... … … 38 38 #include "util/Math.h" 39 39 40 41 40 42 namespace orxonox 41 43 { … … 46 48 RegisterObject(SpaceRaceManager); 47 49 48 for (size_t i = 0; i < this->checkpoints_.size(); ++i) 49 this->setNext(this->checkpoints_[i]); 50 50 this->firstcheckpointvisible_=false; 51 51 52 } 52 53 … … 95 96 { 96 97 SUPER(SpaceRaceManager,tick,dt); 97 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());98 gametype->setV(this);99 98 99 if(this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_) 100 {this->checkpoints_[0]->setRadarVisibility(true);this->firstcheckpointvisible_=false;} 100 101 101 102 for (size_t i = 0; i < this->checkpoints_.size(); ++i){ … … 111 112 assert(gametype); 112 113 113 //if(gametype->getCheckpointReached(player)==-1) {orxout()<<"index -1"<<endl;}114 114 115 115 116 bool b =false; 116 //DistanceMultiTrigger::fire(bIsTriggered,player);117 117 118 int index=gametype->getCheckpointReached(player); 119 Vector3 v=Vector3 (-1,-1,-1); 118 120 if (index>-1){ 119 121 RaceCheckPoint* tmp= this->getCheckpoint(index); 120 Vector3v= tmp->getNextcheckpoint();122 v= tmp->getNextcheckpoint(); 121 123 122 // orxout()<<"index not -1"<<endl;124 123 125 if (this->getCheckpoint(v.x)==check){ 124 126 b=true; … … 137 139 gametype->clock_.capture(); 138 140 float time = gametype->clock_.getSecondsPrecise(); 139 if (check-> bTimeLimit_!=0 && time > check->bTimeLimit_)141 if (check->getTimeLimit()!=0 && time > check->getTimeLimit()) 140 142 { 141 143 gametype->timeIsUp(); … … 146 148 else 147 149 { 150 if (index > -1)this->setRadVis(player,false); 148 151 gametype->newCheckpointReached(check,player); 149 152 check->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red. 153 154 155 156 this->setRadVis(player, true); 157 150 158 } 151 159 } … … 153 161 } 154 162 163 void SpaceRaceManager::setRadVis(PlayerInfo* player, bool b){ 164 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 165 assert(gametype); 166 int index=gametype->getCheckpointReached(player); 167 Vector3 v=Vector3(-1,-1,-1); 168 RaceCheckPoint* tmp= this->getCheckpoint(index); 169 v= tmp->getNextcheckpoint(); 155 170 156 171 157 void SpaceRaceManager::setNext(RaceCheckPoint* check){ 158 159 Vector3 v=check->getNextcheckpoint(); 160 check->setNext(0,this->getCheckpoint(v.x)); 161 check->setNext(1,this->getCheckpoint(v.y)); 162 check->setNext(2,this->getCheckpoint(v.z)); 163 } 172 if(v.x > -1){this->getCheckpoint(v.x)->setRadarVisibility(b); 173 this->getCheckpoint(v.x)->settingsChanged();} 174 if(v.y > -1){this->getCheckpoint(v.y)->setRadarVisibility(b); 175 this->getCheckpoint(v.y)->settingsChanged();} 176 if(v.z > -1){this->getCheckpoint(v.z)->setRadarVisibility(b); 177 this->getCheckpoint(v.z)->settingsChanged();} 178 179 } 180 181 164 182 165 183
Note: See TracChangeset
for help on using the changeset viewer.