Changeset 9260 for code/trunk/src/modules/gametypes/SpaceRace.h
- Timestamp:
- Jun 2, 2012, 10:34:48 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.