Changeset 9260 for code/trunk/src/modules/gametypes
- Timestamp:
- Jun 2, 2012, 10:34:48 PM (13 years ago)
- Location:
- code/trunk/src/modules/gametypes
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
r9016 r9260 42 42 { 43 43 CreateFactory(RaceCheckPoint); 44 45 46 44 47 45 RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this)) 48 46 { 49 47 RegisterObject(RaceCheckPoint); 48 50 49 this->setDistance(100); 51 50 this->setBeaconMode("off"); 52 51 this->setBroadcast(false); 53 52 this->setSimultaneousTriggerers(100); 54 this->bTimeLimit_ = 0;55 53 56 54 this->setRadarObjectColour(ColourValue::Blue); … … 58 56 this->setRadarVisibility(false); 59 57 this->settingsChanged(); 60 this->reached_=NULL; 61 58 59 this->checkpointIndex_ = 0; 60 this->nextcheckpoints_ = Vector3::ZERO; 61 this->bIsLast_ = false; 62 this->timeLimit_ = 0; 63 this->player_ = NULL; 62 64 } 63 65 64 66 65 67 RaceCheckPoint::~RaceCheckPoint() 66 68 { 67 68 69 } 69 70 void RaceCheckPoint::tick(float dt)71 {72 SUPER(RaceCheckPoint, tick, dt);73 74 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());75 assert(gametype);76 }77 70 78 71 void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 79 72 { 80 73 SUPER(RaceCheckPoint, XMLPort, xmlelement, mode); 81 Vector3 v= Vector3(0,0,0); 74 82 75 XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0); 83 XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);76 XMLPortParam(RaceCheckPoint, "islast", setLast, isLast, xmlelement, mode).defaultValues(false); 84 77 XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0); 85 XMLPortParamTemplate(RaceCheckPoint, "nextcheckpoints", setNextcheckpoint, getNextcheckpoint, xmlelement, mode,const Vector3&).defaultValues(v);78 XMLPortParamTemplate(RaceCheckPoint, "nextcheckpoints", setNextcheckpoint, getNextcheckpoint, xmlelement, mode, const Vector3&).defaultValues(Vector3::ZERO); 86 79 } 87 80 88 void RaceCheckPoint::fire(bool bIsTriggered, BaseObject* player)81 void RaceCheckPoint::fire(bool bIsTriggered, BaseObject* originator) 89 82 { 90 DistanceMultiTrigger::fire((bool)bIsTriggered,player); 91 92 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 93 assert(gametype); 94 ControllableEntity* entity = (ControllableEntity*) player; 95 96 PlayerInfo* player2 = entity->getPlayer(); 97 98 if(bIsTriggered) 99 this->reached_=player2; 83 DistanceMultiTrigger::fire(bIsTriggered, originator); 84 85 if (bIsTriggered) 86 { 87 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(originator); 88 if (entity) 89 this->player_ = entity->getPlayer(); 90 } 100 91 } 101 92 102 93 void RaceCheckPoint::setTimelimit(float timeLimit) 103 94 { 104 this-> bTimeLimit_ = timeLimit;105 if (this-> bTimeLimit_ != 0)95 this->timeLimit_ = timeLimit; 96 if (this->timeLimit_ != 0) 106 97 { 107 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 108 assert(gametype); 109 if (gametype) 110 { 111 const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_) 112 + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1); 113 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message); 114 ChatManager::message(message); 115 } 98 std::string message = "You have " + multi_cast<std::string>(this->timeLimit_) 99 + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1); 100 const_cast<GametypeInfo*>(this->getGametype()->getGametypeInfo())->sendAnnounceMessage(message); 101 ChatManager::message(message); 116 102 } 117 103 } 118 119 104 } -
code/trunk/src/modules/gametypes/RaceCheckPoint.h
r9016 r9260 31 31 32 32 #include "gametypes/GametypesPrereqs.h" 33 34 35 36 33 #include "objects/triggers/DistanceMultiTrigger.h" 37 34 #include "interfaces/RadarViewable.h" … … 42 39 @brief 43 40 The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level. 44 41 Don't forget to control the indexes of your check points and to set one last check point 45 42 */ 46 43 class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable … … 51 48 52 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 53 virtual void tick(float dt); 50 54 51 inline void setCheckpointIndex(int checkpointIndex) 55 { this-> bCheckpointIndex_ = checkpointIndex; }56 inline int getCheckpointIndex() 57 { return this-> bCheckpointIndex_; }52 { this->checkpointIndex_ = checkpointIndex; } 53 inline int getCheckpointIndex() const 54 { return this->checkpointIndex_; } 58 55 59 56 inline void setNextcheckpoint(const Vector3& checkpoints) 60 { this->nextcheckpoints_ =checkpoints; }57 { this->nextcheckpoints_ = checkpoints; } 61 58 inline void setNextcheckpoint(float x, float y, float z) 62 59 { this->setNextcheckpoint(Vector3(x, y, z)); } 63 60 inline const Vector3& getNextcheckpoint() const 64 61 { return this->nextcheckpoints_; } 62 65 63 inline void setLast(bool isLast) 66 64 { this->bIsLast_ = isLast; } 67 inline bool getLast()65 inline bool isLast() const 68 66 { return this->bIsLast_; } 69 67 70 bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level. 71 float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses. 72 PlayerInfo* reached_; 73 74 inline float getTimeLimit() 75 { return this->bTimeLimit_; } 76 68 virtual void setTimelimit(float timeLimit); 69 inline float getTimeLimit() const 70 { return this->timeLimit_; } 71 72 inline PlayerInfo* getPlayer() const 73 { return this->player_; } 74 inline void resetPlayer() 75 { this->player_ = NULL; } 76 77 77 protected: 78 virtual void fire(bool bIsTriggered,BaseObject* player); 79 virtual void setTimelimit(float timeLimit); 80 78 virtual void fire(bool bIsTriggered, BaseObject* originator); 79 81 80 inline const WorldEntity* getWorldEntity() const 82 81 { return this; } 83 82 84 83 private: 85 int bCheckpointIndex_; //The index of this check point. The race starts with the check point with the index 0 86 Vector3 nextcheckpoints_; //the indexes of the next check points 87 84 int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0 85 Vector3 nextcheckpoints_; ///< the indexes of the next check points 86 bool bIsLast_; ///< True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level. 87 float timeLimit_; ///< The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses. 88 PlayerInfo* player_; ///< The player that reached the checkpoint 88 89 }; 89 90 } -
code/trunk/src/modules/gametypes/SpaceRace.cc
r9016 r9260 29 29 #include "SpaceRace.h" 30 30 31 32 31 #include "items/Engine.h" 33 32 … … 46 45 { 47 46 RegisterObject(SpaceRace); 48 47 48 this->cantMove_ = false; 49 49 this->bTimeIsUp_ = false; 50 this->numberOfBots_ = 0;51 this->cantMove_=false;52 53 50 } 54 55 56 // void SpaceRace::SetConfigValues(){57 //SUPER(Gametype,setConfigValues);58 //this->Gametype::SetConfigValue(initialStartCountdown_, 3.0f);}59 51 60 52 void SpaceRace::end() … … 62 54 this->Gametype::end(); 63 55 56 this->clock_.capture(); 57 int s = this->clock_.getSeconds(); 58 int ms = static_cast<int>(this->clock_.getMilliseconds() - 1000*s); 59 std::string message; 60 64 61 if (this->bTimeIsUp_) 65 62 { 66 this->clock_.capture(); 67 int s = this->clock_.getSeconds(); 68 int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s); 69 const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n" 63 message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n" 70 64 + "You didn't reach the check point before the time limit. You lose!"; 71 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);72 ChatManager::message(message);73 65 } 74 66 else 75 67 { 76 this->clock_.capture(); 77 int s = this->clock_.getSeconds(); 78 int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s); 79 const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s) 68 message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s) 80 69 + "." + multi_cast<std::string>(ms) + " seconds."; 81 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 82 ChatManager::message(message); 70 } 83 71 84 float time = this->clock_.getSecondsPrecise(); 85 this->scores_.insert(time); 86 std::set<float>::iterator it; 87 88 89 } 72 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 73 ChatManager::message(message); 90 74 } 91 75 92 76 void SpaceRace::start() 93 77 { 78 this->spawnPlayersIfRequested(); 79 Gametype::checkStart(); 80 this->cantMove_ = true; 94 81 95 this->spawnPlayersIfRequested(); 96 Gametype::checkStart(); 97 this->cantMove_=true; 98 99 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 100 { 82 for (ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 101 83 it->setActive(false); 102 103 } 104 this->addBots(this->numberOfBots_); 84 85 this->addBots(this->numberOfBots_); 105 86 } 106 87 107 88 void SpaceRace::tick(float dt) 108 89 { 109 90 SUPER(SpaceRace,tick,dt); 110 111 if (!this->isStartCountdownRunning() && this->cantMove_)91 92 if (!this->isStartCountdownRunning() && this->cantMove_) 112 93 { 113 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 114 { 94 for (ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 115 95 it->setActive(true); 116 117 } 96 118 97 this->cantMove_= false; 119 120 std::string message ("The match has started! Reach the check points as quickly as possible!");98 99 std::string message = "The match has started! Reach the check points as quickly as possible!"; 121 100 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 122 ChatManager::message(message); 101 ChatManager::message(message); 123 102 } 124 125 103 } 126 104 127 128 129 void SpaceRace::newCheckpointReached(SpaceRaceManager* p, int index,PlayerInfo* pl) 105 void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player) 130 106 { 131 this->checkpointReached_[pl]=index; 107 int index = checkpoint->getCheckpointIndex(); 108 this->checkpointReached_[player] = index; 132 109 this->clock_.capture(); 133 110 int s = this->clock_.getSeconds(); 134 int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);111 int ms = this->clock_.getMilliseconds() % 1000; 135 112 const std::string& message = "Checkpoint " + multi_cast<std::string>(index) 136 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 137 + " seconds.";// Message is too long for a normal screen. 113 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds."; 138 114 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 139 115 ChatManager::message(message); 140 116 } 141 142 void SpaceRace::newCheckpointReached(RaceCheckPoint* p, PlayerInfo* pl) 143 { 144 int index = p->getCheckpointIndex(); 145 this->checkpointReached_[pl]=index; 146 this->clock_.capture(); 147 int s = this->clock_.getSeconds(); 148 int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s); 149 const std::string& message = "Checkpoint " + multi_cast<std::string>(index) 150 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 151 + " seconds."; 152 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 153 ChatManager::message(message); 154 } 155 156 117 157 118 void SpaceRace::playerEntered(PlayerInfo* player) 158 119 { 159 120 Gametype::playerEntered(player); 160 161 this->checkpointReached_[player]=-1; 162 //this->playersAlive_++; 121 122 this->checkpointReached_[player] = -1; 163 123 } 164 165 bool SpaceRace::playerLeft(PlayerInfo* player)166 {167 return Gametype::playerLeft(player);168 // bool valid_player = true;169 //if (valid_player)170 // {171 // this->playersAlive_--;172 //}173 124 174 // return valid_player;175 }176 177 125 bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator) 178 126 { -
code/trunk/src/modules/gametypes/SpaceRace.h
r9016 r9260 44 44 namespace orxonox 45 45 { 46 /**47 @brief48 The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.49 */46 /** 47 @brief 48 The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order. 49 */ 50 50 class _GametypesExport SpaceRace : public Gametype 51 51 { 52 52 friend class RaceCheckPoint; 53 53 54 54 55 55 public: … … 57 57 virtual ~SpaceRace() {} 58 58 59 void tick(float dt); 60 59 61 virtual void start(); 60 62 virtual void end(); 61 63 62 virtual void newCheckpointReached(SpaceRaceManager* p, int index,PlayerInfo* pl); 63 virtual void newCheckpointReached(RaceCheckPoint* p, PlayerInfo* pl); 64 virtual void newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player); 64 65 65 inline void setCheckpointReached(int n, PlayerInfo* p)66 { this->checkpointReached_[p ] = n;}67 inline int getCheckpointReached(PlayerInfo* p )68 { return this->checkpointReached_[p ]; }66 inline void setCheckpointReached(int index, PlayerInfo* player) 67 { this->checkpointReached_[player] = index;} 68 inline int getCheckpointReached(PlayerInfo* player) 69 { return this->checkpointReached_[player]; } 69 70 70 inline void timeIsUp()71 inline void setTimeIsUp() 71 72 { this->bTimeIsUp_ = true;} 72 void tick(float dt); 73 Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late. 74 73 inline Clock& getClock() 74 { return this->clock_; } 75 75 76 76 bool allowPawnHit(Pawn* victim, Pawn* originator); 77 bool allowPawnDamage(Pawn* victim, Pawn* originator); 78 bool allowPawnDeath(Pawn* victim, Pawn* originator); 77 79 78 bool allowPawnDamage(Pawn* victim, Pawn* originator); 80 protected: 81 virtual void playerEntered(PlayerInfo* player); ///< Initializes values. 79 82 80 bool allowPawnDeath(Pawn* victim, Pawn* originator);81 protected:82 virtual void playerEntered(PlayerInfo* player); //!< Initializes values.83 virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.84 83 private: 85 84 bool cantMove_; 86 std::map<PlayerInfo*, int>checkpointReached_; //The number of the last check point reached by each player. 87 std::set<float> scores_; //The times of the players are saved in a set. 88 bool bTimeIsUp_; //True if one of the check points is reached too late. 89 90 int playersAlive_; 85 std::map<PlayerInfo*, int> checkpointReached_; ///< The number of the last check point reached by each player. 86 bool bTimeIsUp_; ///< True if one of the check points is reached too late. 87 88 Clock clock_; ///< The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late. 91 89 }; 92 90 } -
code/trunk/src/modules/gametypes/SpaceRaceManager.cc
r9016 r9260 21 21 * 22 22 * Author: 23 * Celine Eggenberger23 * Celine Eggenberger 24 24 * Co-authors: 25 25 * ... … … 47 47 { 48 48 RegisterObject(SpaceRaceManager); 49 50 this->firstcheckpointvisible_=false; 51 49 50 this->firstcheckpointvisible_ = false; 52 51 } 53 52 54 53 SpaceRaceManager::~SpaceRaceManager() 55 54 { 56 if (this->isInitialized()) 55 for (size_t i = 0; i < this->checkpoints_.size(); ++i) 56 this->checkpoints_[i]->destroy(); 57 } 58 59 void SpaceRaceManager::XMLPort(Element& xmlelement, XMLPort::Mode mode) 60 { 61 SUPER(SpaceRaceManager, XMLPort, xmlelement, mode); 62 63 XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint, xmlelement, mode); 64 } 65 66 void SpaceRaceManager::tick(float dt) 67 { 68 SUPER(SpaceRaceManager,tick,dt); 69 70 if (this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_) 57 71 { 58 for (size_t i = 0; i < this->checkpoints_.size(); ++i) 59 this->checkpoints_[i]->destroy(); 72 this->checkpoints_[0]->setRadarVisibility(true); 73 this->firstcheckpointvisible_ = true; 74 } 75 76 for (size_t i = 0; i < this->checkpoints_.size(); ++i) 77 { 78 if (this->checkpoints_[i]->getPlayer() != NULL) 79 this->checkpointReached(this->checkpoints_[i], this->checkpoints_[i]->getPlayer()); 60 80 } 61 81 } 62 82 63 83 void SpaceRaceManager::addCheckpoint(RaceCheckPoint* checkpoint) 64 84 { … … 73 93 return 0; 74 94 } 75 76 int SpaceRaceManager::getIndex(RaceCheckPoint* r)95 96 int SpaceRaceManager::getIndex(RaceCheckPoint* checkpoint) 77 97 { 78 98 for (size_t i = 0; i < this->checkpoints_.size(); ++i) 79 if (this->checkpoints_[i]==r) {return i;} 80 99 if (this->checkpoints_[i] == checkpoint) 100 return i; 101 81 102 return -1; 82 103 } 83 84 void SpaceRaceManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)85 {86 SUPER(SpaceRaceManager, XMLPort, xmlelement, mode);87 104 88 89 XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint, xmlelement, mode);90 }91 92 void SpaceRaceManager::tick(float dt)93 {94 SUPER(SpaceRaceManager,tick,dt);95 96 if(this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_)97 {98 this->checkpoints_[0]->setRadarVisibility(true);99 this->firstcheckpointvisible_=true;100 }101 102 for (size_t i = 0; i < this->checkpoints_.size(); ++i)103 {104 if(this->checkpoints_[i]->reached_!=NULL)105 this->checkpointReached(this->checkpoints_[i],this->checkpoints_[i]->reached_);106 }107 }108 109 110 105 void SpaceRaceManager::checkpointReached(RaceCheckPoint* check, PlayerInfo* player) 111 106 { 112 107 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 113 108 assert(gametype); 114 115 bool b =false; 116 117 int index=gametype->getCheckpointReached(player); 118 Vector3 v=Vector3 (-1,-1,-1); 119 if (index>-1) 109 110 bool reachedValidCheckpoint = false; 111 112 int index = gametype->getCheckpointReached(player); 113 if (index > -1) 120 114 { 121 RaceCheckPoint* tmp= this->getCheckpoint(index); 122 v= tmp->getNextcheckpoint(); 123 115 Vector3 v = this->getCheckpoint(index)->getNextcheckpoint(); 116 124 117 if (this->getCheckpoint(v.x) == check) 125 118 { 126 b = true; 127 } 128 119 reachedValidCheckpoint = true; 120 } 129 121 if (this->getCheckpoint(v.y) == check) 130 122 { 131 b= true;132 } 123 reachedValidCheckpoint = true; 124 } 133 125 if (this->getCheckpoint(v.z) == check) 134 126 { 135 b= true;136 } 127 reachedValidCheckpoint = true; 128 } 137 129 } 138 130 else 139 131 { 140 b= (this->getIndex(check) == 0);132 reachedValidCheckpoint = (this->getIndex(check) == 0); 141 133 } 142 143 if (gametype && b)134 135 if (gametype && reachedValidCheckpoint) 144 136 { 145 gametype-> clock_.capture();146 float time = gametype-> clock_.getSecondsPrecise();147 if (check->getTimeLimit() !=0 && time > check->getTimeLimit())137 gametype->getClock().capture(); 138 float time = gametype->getClock().getSecondsPrecise(); 139 if (check->getTimeLimit() != 0 && time > check->getTimeLimit()) 148 140 { 149 gametype-> timeIsUp();141 gametype->setTimeIsUp(); 150 142 gametype->end(); 151 143 } 152 else if (check-> getLast())144 else if (check->isLast()) 153 145 gametype->end(); 154 146 else 155 { 156 if (index > -1)this->setRadVis(player,false); 157 else this->getCheckpoint(0)->setRadarVisibility(false); 158 gametype->newCheckpointReached(check,player); 159 160 147 { 148 if (index > -1) 149 this->setRadVis(player, false); 150 else 151 this->getCheckpoint(0)->setRadarVisibility(false); 152 153 gametype->newCheckpointReached(check, player); 161 154 this->setRadVis(player, true); 162 155 } 163 156 } 164 check->reached_=NULL; 157 158 check->resetPlayer(); 165 159 } 166 167 void SpaceRaceManager::setRadVis(PlayerInfo* player, bool b )160 161 void SpaceRaceManager::setRadVis(PlayerInfo* player, bool bVisible) 168 162 { 169 163 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 170 164 assert(gametype); 171 165 int index = gametype->getCheckpointReached(player); 172 Vector3 v = Vector3(-1,-1,-1); 173 RaceCheckPoint* tmp = this->getCheckpoint(index); 174 v = tmp->getNextcheckpoint(); 175 176 if(v.x > -1) 166 Vector3 v = this->getCheckpoint(index)->getNextcheckpoint(); 167 168 if (v.x > -1) 177 169 { 178 this->getCheckpoint(v.x)->setRadarVisibility(b );170 this->getCheckpoint(v.x)->setRadarVisibility(bVisible); 179 171 this->getCheckpoint(v.x)->settingsChanged(); 180 172 } 181 if (v.y > -1)173 if (v.y > -1) 182 174 { 183 this->getCheckpoint(v.y)->setRadarVisibility(b );175 this->getCheckpoint(v.y)->setRadarVisibility(bVisible); 184 176 this->getCheckpoint(v.y)->settingsChanged(); 185 177 } 186 if (v.z > -1)178 if (v.z > -1) 187 179 { 188 this->getCheckpoint(v.z)->setRadarVisibility(b );189 this->getCheckpoint(v.z)->settingsChanged();180 this->getCheckpoint(v.z)->setRadarVisibility(bVisible); 181 this->getCheckpoint(v.z)->settingsChanged(); 190 182 } 191 192 193 183 } 194 195 184 } -
code/trunk/src/modules/gametypes/SpaceRaceManager.h
r9016 r9260 46 46 namespace orxonox 47 47 { 48 /**49 @brief50 The SpaceRaceManager class controls a space race level, where the player has to reach check points in a given order.51 */48 /** 49 @brief 50 The SpaceRaceManager class controls a space race level, where the player has to reach check points in a given order. 51 */ 52 52 class _GametypesExport SpaceRaceManager : public BaseObject, public Tickable 53 53 { 54 54 friend class RaceCheckPoint; 55 55 56 56 public: 57 57 SpaceRaceManager(BaseObject* creator); 58 58 virtual ~SpaceRaceManager() ; 59 59 60 void XMLPort(Element& xmlelement, XMLPort::Mode mode); 61 int getIndex(RaceCheckPoint* r); 60 void XMLPort(Element& xmlelement, XMLPort::Mode mode); 61 62 62 void addCheckpoint(RaceCheckPoint* checkpoint); 63 63 RaceCheckPoint* getCheckpoint(unsigned int index) const; 64 64 int getIndex(RaceCheckPoint* checkpoint); 65 65 66 void checkpointReached(RaceCheckPoint* check, PlayerInfo* player); 66 67 67 68 void tick(float dt); 68 69 69 70 protected: 70 void setRadVis(PlayerInfo* player, bool b );//sets RadarVisibility of the checkpoints the player can reach.71 71 void setRadVis(PlayerInfo* player, bool bVisible); ///< sets RadarVisibility of the checkpoints the player can reach. 72 72 73 private: 73 74 std::vector<RaceCheckPoint*> checkpoints_; 74 bool firstcheckpointvisible_;//true if the first check point is visible. 75 75 bool firstcheckpointvisible_; ///< true if the first check point is visible. 76 76 }; 77 77 }
Note: See TracChangeset
for help on using the changeset viewer.