Changeset 8934 for code/branches
- Timestamp:
- Nov 16, 2011, 2:07:17 PM (13 years ago)
- Location:
- code/branches/spaceraceTwo/src/modules/gametypes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.cc
r8928 r8934 36 36 #include "SpaceRace.h" 37 37 38 39 38 namespace orxonox 40 39 { … … 48 47 this->bIsLast_ = false; 49 48 this->bTimeLimit_ = 0; 49 this->isVisible_=false; 50 50 51 51 this->setRadarObjectColour(ColourValue::Blue); … … 70 70 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 71 71 assert(gametype); 72 this->setRadarVisibility(false); 72 if(this->isVisible_){this->setRadarVisibility(true);} 73 else{this->setRadarVisibility(false);} 74 /*this->setRadarVisibility(false); 73 75 Vector3 v =Vector3(0,0,0); 74 76 int j=0; … … 81 83 if (this->getCheckpointIndex() == v[i]) 82 84 this->setRadarVisibility(true); 83 } 84 }85 }*/ 86 //} 85 87 } 86 88 … … 95 97 } 96 98 97 98 99 void RaceCheckPoint::triggered(bool bIsTriggered, PlayerInfo* player) 99 void RaceCheckPoint::triggered(bool bIsTriggered, PlayerInfo* player) 100 100 { 101 101 DistanceTrigger::triggered(bIsTriggered); -
code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h
r8928 r8934 61 61 inline const Vector3& getNextcheckpoint() const 62 62 {return this->nextcheckpoints_;} 63 64 inline void setVisibility(bool b) 65 {this->isVisible_ = b;} 63 66 protected: 64 67 virtual void triggered(bool bIsTriggered, PlayerInfo* player); … … 84 87 85 88 Vector3 nextcheckpoints_; //the indexes of the next check points 89 90 bool isVisible_; 86 91 87 92 }; -
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc
r8928 r8934 45 45 { 46 46 RegisterObject(SpaceRace); 47 //this->checkpointsReached_ = 0;47 this->checkpointReached_ = 0; 48 48 this->bTimeIsUp_ = false; 49 49 this->numberOfBots_ = 0; … … 139 139 140 140 141 void SpaceRace::newCheckpointReached( RaceCheckPoint* p)141 void SpaceRace::newCheckpointReached(SpaceRaceManager* p, int index) 142 142 { 143 this->checkpointReached_= p->getCheckpointIndex();143 this->checkpointReached_=index; 144 144 this->clock_.capture(); 145 145 int s = this->clock_.getSeconds(); 146 146 int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s); 147 const std::string& message = "Checkpoint " + multi_cast<std::string>(p) 147 const std::string& message = "Checkpoint " + multi_cast<std::string>(index) 148 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 149 + " seconds."; 150 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 151 ChatManager::message(message); 152 153 154 } 155 156 void SpaceRace::newCheckpointReached(RaceCheckPoint* p) 157 { int index = p->getCheckpointIndex(); 158 this->checkpointReached_=index; 159 this->clock_.capture(); 160 int s = this->clock_.getSeconds(); 161 int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s); 162 const std::string& message = "Checkpoint " + multi_cast<std::string>(index) 148 163 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 149 164 + " seconds."; -
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.h
r8928 r8934 40 40 #include "gametypes/Gametype.h" 41 41 42 #include "RaceCheckPoint.h" 42 43 44 #include "SpaceRaceManager.h" 43 45 44 46 namespace orxonox … … 51 53 { 52 54 friend class RaceCheckPoint; 55 friend class SpaceRaceManager; 53 56 54 57 public: … … 59 62 virtual void end(); 60 63 61 virtual void newCheckpointReached(RaceCheckPoint* p); 64 virtual void newCheckpointReached(SpaceRaceManager* p, int index); 65 virtual void newCheckpointReached(RaceCheckPoint* p); 62 66 63 67 inline void setCheckpointReached(int n) -
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc
r8928 r8934 28 28 29 29 #include "SpaceRaceManager.h" 30 30 #include "SpaceRace.h" 31 31 32 32 #include "core/XMLPort.h" … … 80 80 { 81 81 SUPER(SpaceRaceManager,tick,dt); 82 82 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 83 Vector3 v =Vector3(0,0,0); 84 int j=0; 85 for (std::map<PlayerInfo*, Player>::iterator it = gametype->players_.begin(); it != gametype->players_.end(); ++it) 86 { 87 j=gametype->getCheckpointReached(it->first); 88 RaceCheckPoint* r=this->getCheckpoint(j); 89 v=r->getNextcheckpoint(); 90 for(int i=1;i<4;i++){ 91 RaceCheckPoint* n=this->getCheckpoint(i); 92 n->setVisibility(true); 93 } 94 } 95 83 96 } 84 85 86 87 88 89 90 } 97 } 91 98 92 99
Note: See TracChangeset
for help on using the changeset viewer.