Changeset 9526 for code/trunk/src/modules/gametypes/RaceCheckPoint.h
- Timestamp:
- Feb 19, 2013, 10:25:42 AM (11 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/gametypes/RaceCheckPoint.h
r9263 r9526 37 37 { 38 38 /** 39 @brief 40 The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level. 41 Don't forget to control the indexes of your check points and to set one last check point 42 */ 43 class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable 39 @brief 40 The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level. 41 Don't forget to control the indexes of your check points and to set one last check point 42 */ 43 class _GametypesExport RaceCheckPoint: public DistanceMultiTrigger, 44 public RadarViewable 44 45 { 45 46 public: … … 50 51 51 52 inline void setCheckpointIndex(int checkpointIndex) 52 { this->checkpointIndex_ = checkpointIndex; } 53 { 54 this->checkpointIndex_ = checkpointIndex; 55 } 53 56 inline int getCheckpointIndex() const 54 { return this->checkpointIndex_; } 57 { 58 return this->checkpointIndex_; 59 } 55 60 56 61 void setNextCheckpointsAsVector3(const Vector3& checkpoints); 57 Vector3 getNextCheckpointsAsVector3() const; 58 const std::set<int>& getNextCheckpoints() const 59 { return this->nextCheckpoints_; } 62 Vector3 getNextCheckpointsAsVector3(); 63 Vector3 getVirtualNextCheckpointsAsVector3() const; 64 void setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints); 65 int changeVirtualToRealCheckPoint(int); 60 66 67 const std::set<int>& getVirtualNextCheckpoints() const 68 { 69 return this->nextCheckpointsVirtual_; 70 } 71 72 const std::set<int>& getNextCheckpoints() 73 { 74 return nextCheckpoints_; 75 std::set<int> temp; 76 std::set<int> temp2=getVirtualNextCheckpoints(); 77 for (std::set<int>::iterator it = temp2.begin(); it!=temp2.end(); ++it){ 78 temp.insert(changeVirtualToRealCheckPoint((*it))); 79 } 80 return temp; 81 } 61 82 inline void setLast(bool isLast) 62 { this->bIsLast_ = isLast; } 83 { 84 this->bIsLast_ = isLast; 85 } 63 86 inline bool isLast() const 64 { return this->bIsLast_; } 87 { 88 return this->bIsLast_; 89 } 65 90 66 91 virtual void setTimelimit(float timeLimit); 67 92 inline float getTimeLimit() const 68 { return this->timeLimit_; } 93 { 94 return this->timeLimit_; 95 } 69 96 70 inline PlayerInfo* getPlayer() const 71 { return this->player_; } 97 PlayerInfo* getPlayer(unsigned int clientID) const; 98 99 bool playerWasHere(PlayerInfo* ) const; 100 72 101 inline void resetPlayer() 73 { this->player_ = NULL; } 102 { 103 this->players_.clear(); 104 } 74 105 75 106 protected: 107 76 108 virtual void fire(bool bIsTriggered, BaseObject* originator); 77 109 78 110 inline const WorldEntity* getWorldEntity() const 79 { return this; } 111 { 112 return this; 113 } 80 114 81 115 private: 82 int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0 116 117 int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0 83 118 std::set<int> nextCheckpoints_; ///< the indexes of the next check points 84 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. 85 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. 86 PlayerInfo* player_; ///< The player that reached the checkpoint 119 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. 120 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. 121 std::vector<PlayerInfo*> players_; ///< The player that reached the checkpoint 122 Vector3 myPosition_; 123 std::set<int> nextCheckpointsVirtual_; 124 std::map<int,int> virtualToRealCheckPoints_; // if virtualChepoint was inserted the original can be reconstructed 87 125 }; 88 126 }
Note: See TracChangeset
for help on using the changeset viewer.