Changeset 7579 for code/branches/lastmanstanding/src
- Timestamp:
- Oct 22, 2010, 4:19:40 PM (14 years ago)
- Location:
- code/branches/lastmanstanding/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
r7556 r7579 34 34 #include "worldentities/pawns/Pawn.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "util/Convert.h" 36 37 37 38 namespace orxonox … … 46 47 this->playersAlive=0; 47 48 this->timeRemaining=20.0f; 49 this->setHUDTemplate("LastmanstandingHUD"); 48 50 } 49 51 … … 128 130 COUT(0) << message << std::endl; 129 131 Host::Broadcast(message); 132 //Update: EachPlayer's "Players in Game"-HUD 133 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 134 { 135 if (it->first->getClientID() == CLIENTID_UNKNOWN) 136 continue; 137 const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive); 138 this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 139 } 140 130 141 } 131 142 … … 142 153 COUT(0) << message << std::endl; 143 154 Host::Broadcast(message); 155 //Update: EachPlayer's "Players in Game"-HUD 156 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 157 { 158 if (it->first->getClientID() == CLIENTID_UNKNOWN) 159 continue; 160 const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive); 161 this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 162 } 144 163 } 145 164 … … 159 178 160 179 return valid_player; 180 } 181 182 void LastManStanding::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) 183 { 184 if (!player) 185 return; 186 //Update: Individual Players "lifes"-HUD 187 std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(player); 188 if (it2 != this->players_.end()) 189 { 190 const std::string& message = "Your Lives: " +multi_cast<std::string>(playerLives_[player]); 191 this->gtinfo_->sendFadingMessage(message,it2->first->getClientID()); 192 193 } 194 } 195 196 void LastManStanding::playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn) 197 { 198 //Update: EachPlayer's "Players in Game"-HUD 199 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 200 { 201 if (it->first->getClientID() == CLIENTID_UNKNOWN) 202 continue; 203 const std::string& message1 = "Remaining Players : "+ multi_cast<std::string>(playersAlive); 204 this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 205 } 206 161 207 } 162 208 … … 224 270 this->timeToAct_[player]=timeRemaining+3.0f;//reset timer 225 271 } 272 226 273 } 227 274 } 228 275 229 230 276 void LastManStanding::tick(float dt) 231 277 { -
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
r7556 r7579 30 30 @brief Declaration of the Gametype "Last Man Standing". 31 31 */ 32 /* BY THE WAY 33 //!You have to ADD BOTS (or any other further players) BEFORE actually starting a match! 34 //Maybe a warning should be added in the menu, if a player starts a Last Man Standing match alone. 35 //Whenever there is only on player in the game, this player will be declared as winner. 36 //How "death" is managed: dead players cannot respawn. 37 */ 32 38 33 #ifndef _LastManStanding_H__ 39 34 #define _LastManStanding_H__ … … 72 67 virtual void start(); //!< Sends a start message. 73 68 virtual void end(); //!< Sends an end message. 74 virtual void playerEntered(PlayerInfo* player); 75 virtual bool playerLeft(PlayerInfo* player); 69 virtual void playerEntered(PlayerInfo* player); //!< Initializes values. Manages the gametype's HUD. #Players alive via StaticMessage. 70 virtual bool playerLeft(PlayerInfo* player); //!< Manages the gametype's HUD. #Players alive via StaticMessage. 76 71 virtual bool playerChangedName(PlayerInfo* player); 77 72 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Manages the gametype's HUD. player's lives via FadingMessage. 73 virtual void playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Manages the gametype's HUD. #Players alive via StaticMessage. 78 74 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 79 75 80 const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_" 76 const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_". 81 77 void killPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining". 82 78 void tick (float dt); //!< used to end the game
Note: See TracChangeset
for help on using the changeset viewer.