Changeset 8450
- Timestamp:
- May 12, 2011, 12:11:53 AM (14 years ago)
- Location:
- code/branches/tutoriallevel2
- Files:
-
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutoriallevel2/data/overlays/debug.oxo
r8079 r8450 84 84 /> 85 85 86 <GametypeStatus87 name = "state"88 position = "0.5, 0.85"89 font = "VeraMono"90 textsize = 0.0591 colour = "1.0, 1.0, 0.0, 0.8"92 align = "center"93 />94 86 </OverlayGroup> 95 87 </Template> -
code/branches/tutoriallevel2/src/modules/notifications/NotificationQueueCEGUI.cc
r8449 r8450 49 49 // Register tolua_open function when loading the library. 50 50 DeclareToluaInterface(Notifications); 51 52 /*static*/ const std::string NotificationQueueCEGUI::NOTIFICATION_LAYER("NotificationLayer"); 51 53 52 54 NotificationQueueCEGUI::NotificationQueueCEGUI(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime) : NotificationQueue(name, senders, size, displayTime) … … 81 83 // Remove the NotificationQueue in lua. 82 84 if(GameMode::showsGraphics() && !noGraphics) 83 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.removeQueue(\"" + this->getName() + "\")");85 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")"); 84 86 85 87 NotificationQueue::destroy(); … … 110 112 this->displaySize_ = size; 111 113 if(size.z == 0.0 && size.w == 0.0) 112 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ")");114 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ")"); 113 115 else 114 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ", " + multi_cast<std::string>(this->displaySize_.z) + ", " + multi_cast<std::string>(this->displaySize_.w) + ")");116 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ", " + multi_cast<std::string>(this->displaySize_.z) + ", " + multi_cast<std::string>(this->displaySize_.w) + ")"); 115 117 } 116 118 … … 137 139 138 140 this->position_ = position; 139 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.moveQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->position_.x) + ", " + multi_cast<std::string>(this->position_.y) + ", " + multi_cast<std::string>(this->position_.z) + ", " + multi_cast<std::string>(this->position_.w) + ")");141 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".moveQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->position_.x) + ", " + multi_cast<std::string>(this->position_.y) + ", " + multi_cast<std::string>(this->position_.z) + ", " + multi_cast<std::string>(this->position_.w) + ")"); 140 142 } 141 143 … … 154 156 // TODO: Check whether the alignment string is correct? 155 157 this->alignment_ = alignment; 156 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.changeQueueAlignment(\"" + this->getName() + "\", \"" + this->alignment_ + "\")");158 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueAlignment(\"" + this->getName() + "\", \"" + this->alignment_ + "\")"); 157 159 } 158 160 … … 169 171 170 172 this->fontSize_ = size; 171 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.changeQueueFontSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->fontSize_) + ")");173 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->fontSize_) + ")"); 172 174 } 173 175 … … 189 191 stream << std::hex << std::setw(2) << std::setfill('0') << int(this->fontColor_[(i+3)%4]*255); 190 192 this->fontColorStr_ = stream.str(); 191 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.changeQueueFontColor(\"" + this->getName() + "\", \"" + this->fontColorStr_ + "\")");193 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontColor(\"" + this->getName() + "\", \"" + this->fontColorStr_ + "\")"); 192 194 } 193 195 … … 218 220 // Push the Notification to the GUI. 219 221 if(GameMode::showsGraphics()) 220 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")");222 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")"); 221 223 } 222 224 … … 229 231 // Pops the Notification from the GUI. 230 232 if(GameMode::showsGraphics()) 231 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.popNotification(\"" + this->getName() + "\")");233 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".popNotification(\"" + this->getName() + "\")"); 232 234 } 233 235 … … 240 242 // Removes the Notification from the GUI. 241 243 if(GameMode::showsGraphics()) 242 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")");244 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")"); 243 245 } 244 246 … … 255 257 // Clear the NotificationQueue in the GUI. 256 258 if(GameMode::showsGraphics() && !noGraphics) 257 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.clearQueue(\"" + this->getName() + "\")");259 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".clearQueue(\"" + this->getName() + "\")"); 258 260 } 259 261 … … 265 267 { 266 268 if(GameMode::showsGraphics()) 267 GUIManager::getInstance().getLuaState()->doString( "NotificationLayer.createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");269 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")"); 268 270 } 269 271 -
code/branches/tutoriallevel2/src/modules/notifications/NotificationQueueCEGUI.h
r8448 r8450 127 127 { return this->fontColorStr_; } 128 128 129 static NotificationQueueCEGUI* getQueue(const std::string& name); // tolua_export 129 static NotificationQueueCEGUI* getQueue(const std::string& name); // tolua_export // Get the NotificationQueueCEGUI with the input name. 130 130 131 131 protected: … … 135 135 136 136 virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers. 137 138 protected: 139 static const std::string NOTIFICATION_LAYER; //!< The name of the NotificationLayer menu sheet. 137 140 138 141 private: -
code/branches/tutoriallevel2/src/modules/overlays/hud/CMakeLists.txt
r8178 r8450 7 7 HUDTimer.cc 8 8 ChatOverlay.cc 9 GametypeStatus.cc10 9 AnnounceMessage.cc 11 10 KillMessage.cc -
code/branches/tutoriallevel2/src/orxonox/gametypes/Gametype.cc
r8327 r8450 59 59 this->defaultControllableEntity_ = Class(Spectator); 60 60 61 this->bFirstTick_ = true; 62 61 63 this->bAutoStart_ = false; 62 64 this->bForceSpawn_ = false; … … 112 114 SUPER(Gametype, tick, dt); 113 115 116 // Activate the GametypeInfo. 117 if(this->bFirstTick_) 118 { 119 this->gtinfo_->setActive(true); 120 this->bFirstTick_ = false; 121 } 122 114 123 //count timer 115 124 if (timerIsActive_) … … 121 130 } 122 131 123 if (this->gtinfo_-> bStartCountdownRunning_ && !this->gtinfo_->bStarted_)124 this->gtinfo_-> startCountdown_ -= dt;125 126 if (!this->gtinfo_-> bStarted_)132 if (this->gtinfo_->isStartCountdownRunning() && !this->gtinfo_->hasStarted()) 133 this->gtinfo_->countdownStartCountdown(dt); 134 135 if (!this->gtinfo_->hasStarted()) 127 136 this->checkStart(); 128 else if (!this->gtinfo_-> bEnded_)137 else if (!this->gtinfo_->hasEnded()) 129 138 this->spawnDeadPlayersIfRequested(); 130 139 … … 136 145 this->addBots(this->numberOfBots_); 137 146 138 this->gtinfo_-> bStarted_ = true;147 this->gtinfo_->start(); 139 148 140 149 this->spawnPlayersIfRequested(); … … 143 152 void Gametype::end() 144 153 { 145 this->gtinfo_-> bEnded_ = true;154 this->gtinfo_->end(); 146 155 147 156 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) … … 270 279 } 271 280 281 if(victim->getPlayer()->isHumanPlayer()) 282 this->gtinfo_->pawnKilled(victim->getPlayer()); 283 272 284 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator()); 273 285 if (victim->getCamera()) … … 346 358 it->second.state_ = PlayerState::Dead; 347 359 348 if (!it->first->isReadyToSpawn() || !this->gtinfo_-> bStarted_)360 if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted()) 349 361 { 350 362 this->spawnPlayerAsDefaultPawn(it->first); … … 357 369 void Gametype::checkStart() 358 370 { 359 if (!this->gtinfo_-> bStarted_)360 { 361 if (this->gtinfo_-> bStartCountdownRunning_)362 { 363 if (this->gtinfo_-> startCountdown_ <= 0)364 { 365 this->gtinfo_-> bStartCountdownRunning_ = false;366 this->gtinfo_->s tartCountdown_ = 0;371 if (!this->gtinfo_->hasStarted()) 372 { 373 if (this->gtinfo_->isStartCountdownRunning()) 374 { 375 if (this->gtinfo_->getStartCountdown() <= 0.0f) 376 { 377 this->gtinfo_->stopStartCountdown(); 378 this->gtinfo_->setStartCountdown(0.0f);; 367 379 this->start(); 368 380 } … … 384 396 if (it->first->isHumanPlayer()) 385 397 hashumanplayers = true; 398 399 // Inform the GametypeInfo that the player is ready to spawn. 400 // TODO: Can it happen, that that changes? 401 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn()) 402 this->gtinfo_->playerReadyToSpawn(it->first); 386 403 } 387 404 if (allplayersready && hashumanplayers) … … 389 406 // If in developer's mode, there is no start countdown. 390 407 if(Core::getInstance().inDevMode()) 391 this-> gtinfo_->startCountdown_ = 0;408 this->start(); 392 409 else 393 this->gtinfo_->s tartCountdown_ = this->initialStartCountdown_;394 this->gtinfo_-> bStartCountdownRunning_ = true;410 this->gtinfo_->setStartCountdown(this->initialStartCountdown_); 411 this->gtinfo_->startStartCountdown(); 395 412 } 396 413 } … … 402 419 { 403 420 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 421 { 404 422 if (it->first->isReadyToSpawn() || this->bForceSpawn_) 405 423 this->spawnPlayer(it->first); 424 } 406 425 } 407 426 … … 422 441 player->startControl(spawnpoint->spawn()); 423 442 this->players_[player].state_ = PlayerState::Alive; 443 444 if(player->isHumanPlayer()) 445 this->gtinfo_->playerSpawned(player); 446 424 447 this->playerPostSpawn(player); 425 448 } -
code/branches/tutoriallevel2/src/orxonox/gametypes/Gametype.h
r8178 r8450 78 78 79 79 inline bool hasStarted() const 80 { return this->gtinfo_-> bStarted_; }80 { return this->gtinfo_->hasStarted(); } 81 81 inline bool hasEnded() const 82 { return this->gtinfo_-> bEnded_; }82 { return this->gtinfo_->hasEnded(); } 83 83 84 84 virtual void start(); … … 114 114 115 115 inline bool isStartCountdownRunning() const 116 { return this->gtinfo_-> bStartCountdownRunning_; }116 { return this->gtinfo_->isStartCountdownRunning(); } 117 117 inline float getStartCountdown() const 118 { return this->gtinfo_-> startCountdown_; }118 { return this->gtinfo_->getStartCountdown(); } 119 119 120 120 inline void setHUDTemplate(const std::string& name) 121 { this->gtinfo_-> hudtemplate_ = name; }121 { this->gtinfo_->setHUDTemplate(name); } 122 122 inline const std::string& getHUDTemplate() const 123 { return this->gtinfo_-> hudtemplate_; }123 { return this->gtinfo_->getHUDTemplate(); } 124 124 125 125 void addBots(unsigned int amount); … … 168 168 SmartPtr<GametypeInfo> gtinfo_; 169 169 170 bool bFirstTick_; //!< Whether this is the first tick or not. 171 170 172 bool bAutoStart_; 171 173 bool bForceSpawn_; -
code/branches/tutoriallevel2/src/orxonox/infos/GametypeInfo.cc
r8327 r8450 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Damian 'Mozork' Frick 26 26 * 27 27 */ 28 29 /** 30 @file GametypeInfo.cc 31 @brief Implementation of the GametypeInfo class 32 */ 28 33 29 34 #include "GametypeInfo.h" … … 31 36 #include "core/CoreIncludes.h" 32 37 #include "core/GameMode.h" 38 #include "network/Host.h" 33 39 #include "network/NetworkFunction.h" 34 #include "network/Host.h" 40 #include "util/Convert.h" 41 35 42 #include "interfaces/GametypeMessageListener.h" 43 #include "interfaces/NotificationListener.h" 44 45 #include "PlayerInfo.h" 36 46 37 47 namespace orxonox … … 45 55 registerMemberNetworkFunction(GametypeInfo, dispatchFadingMessage); 46 56 57 /*static*/ const std::string GametypeInfo::NOTIFICATION_SENDER("gameinfo"); 58 59 /** 60 @brief 61 Registers and initializes the object. 62 */ 47 63 GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator) 48 64 { 49 65 RegisterObject(GametypeInfo); 50 66 67 this->bActive_ = false; // At first the GametypeInfo is inactive. 68 51 69 this->bStarted_ = false; 52 70 this->bEnded_ = false; 53 this->startCountdown_ = 0 ;71 this->startCountdown_ = 0.0f; 54 72 this->bStartCountdownRunning_ = false; 73 this->counter_ = 0; 55 74 56 75 this->registerVariables(); … … 63 82 void GametypeInfo::registerVariables() 64 83 { 65 registerVariable(this->bStarted_, VariableDirection::ToClient); 66 registerVariable(this->bEnded_, VariableDirection::ToClient); 84 registerVariable(this->bStarted_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedStarted)); 85 registerVariable(this->bEnded_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedEnded)); 86 registerVariable(this->bStartCountdownRunning_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedStartCountdownRunning)); 67 87 registerVariable(this->startCountdown_, VariableDirection::ToClient); 68 registerVariable(this-> bStartCountdownRunning_, VariableDirection::ToClient);88 registerVariable(this->counter_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedCountdownCounter)); 69 89 registerVariable(this->hudtemplate_, VariableDirection::ToClient); 90 } 91 92 /** 93 @brief 94 Is called when the activity has changed. 95 */ 96 void GametypeInfo::changedActivity(void) 97 { 98 SUPER(GametypeInfo, changedActivity); 99 100 // If the GametypeInfo has become active the "Press [Fire] to start the match" notification is sent. 101 if(this->isActive()) 102 NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER); 103 } 104 105 /** 106 @brief 107 Is called when the game has changed to started. 108 */ 109 void GametypeInfo::changedStarted(void) 110 { 111 112 } 113 114 /** 115 @brief 116 Is called when the game has changed to ended. 117 */ 118 void GametypeInfo::changedEnded(void) 119 { 120 // If the game has ended, a "Game has ended" notification is displayed. 121 if(this->hasEnded()) 122 NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER); 123 } 124 125 /** 126 @brief 127 Is called when the start countdown has been either started or stopped. 128 */ 129 void GametypeInfo::changedStartCountdownRunning(void) 130 { 131 // Clear the notifications if the countdown has stopped running. 132 if(!this->hasStarted() && !this->isStartCountdownRunning() && !this->hasEnded()) 133 NotificationListener::sendCommand("clear", GametypeInfo::NOTIFICATION_SENDER); 134 // Send first countdown notification if the countdown has started. 135 if(!this->hasStarted() && this->isStartCountdownRunning() && !this->hasEnded()) 136 NotificationListener::sendNotification(multi_cast<std::string>(this->counter_), GametypeInfo::NOTIFICATION_SENDER); 137 } 138 139 /** 140 @brief 141 Is called when the start countdown counter has changed. 142 */ 143 void GametypeInfo::changedCountdownCounter(void) 144 { 145 // Send countdown notification if the counter has gone down. 146 if(!this->hasStarted() && this->isStartCountdownRunning() && !this->hasEnded()) 147 NotificationListener::sendNotification(multi_cast<std::string>(this->counter_), GametypeInfo::NOTIFICATION_SENDER); 148 } 149 150 /** 151 @brief 152 Is called when a player has become ready to spawn. 153 @param player 154 The player that has become ready to spawn. 155 */ 156 void GametypeInfo::changedReadyToSpawn(PlayerInfo* player) 157 { 158 // Send "Waiting for other players" over the network to the right player if a player has become ready to spawn. 159 if(!this->hasStarted() && !this->isStartCountdownRunning() && !this->hasEnded()) 160 NotificationListener::sendNotification("Waiting for other players", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID()); 161 // Clear the notifications if the player has respawned. 162 if(this->hasStarted() && !this->hasEnded()) 163 NotificationListener::sendCommand("clear", GametypeInfo::NOTIFICATION_SENDER, notificationSendMode::network, player->getClientID()); 164 } 165 166 /** 167 @brief 168 Inform the GametypeInfo that the game has started. 169 */ 170 void GametypeInfo::start(void) 171 { 172 if(this->bStarted_) 173 return; 174 175 this->bStarted_ = true; 176 this->changedStarted(); 177 } 178 179 /** 180 @brief 181 Inform the GametypeInfo that the game has ended. 182 */ 183 void GametypeInfo::end(void) 184 { 185 if(this->bEnded_) 186 return; 187 188 this->bEnded_ = true; 189 this->changedEnded(); 190 } 191 192 /** 193 @brief 194 Set the start countdown to the input value. 195 @param countdown 196 The countdown to be set. 197 */ 198 void GametypeInfo::setStartCountdown(float countdown) 199 { 200 if(this->startCountdown_ == countdown || countdown < 0.0f) 201 return; 202 203 this->startCountdown_ = countdown; 204 // Set the counter to the ceiling of the current countdown. 205 this->counter_ = ceil(countdown); 206 this->changedCountdownCounter(); 207 } 208 209 /** 210 @brief 211 Count down the start countdown by the specified value. 212 @param countDown 213 The amount by which we count down. 214 */ 215 void GametypeInfo::countdownStartCountdown(float countDown) 216 { 217 float newCountdown = this->startCountdown_ - countDown; 218 // If we have switched integers or arrived at zero, we also count down the start countdown counter. 219 if(ceil(newCountdown) != ceil(this->startCountdown_) || newCountdown <= 0.0f) 220 this->countDown(); 221 this->startCountdown_ = newCountdown; 222 } 223 224 /** 225 @brief 226 Count down the start countdown counter. 227 */ 228 void GametypeInfo::countDown() 229 { 230 if(this->counter_ == 0) 231 return; 232 233 this->counter_--; 234 this->changedCountdownCounter(); 235 } 236 237 /** 238 @brief 239 Inform the GametypeInfo about the start of the start countdown. 240 */ 241 void GametypeInfo::startStartCountdown(void) 242 { 243 if(this->bStartCountdownRunning_) 244 return; 245 246 this->bStartCountdownRunning_ = true; 247 this->changedStartCountdownRunning(); 248 } 249 250 /** 251 @brief 252 Inform the GametypeInfo about the stop of the start countdown. 253 */ 254 void GametypeInfo::stopStartCountdown(void) 255 { 256 if(!this->bStartCountdownRunning_) 257 return; 258 259 this->bStartCountdownRunning_ = false; 260 this->changedStartCountdownRunning(); 261 } 262 263 /** 264 @brief 265 Inform the GametypeInfo about a player that is ready to spawn. 266 @param player 267 The player that is ready to spawn. 268 */ 269 void GametypeInfo::playerReadyToSpawn(PlayerInfo* player) 270 { 271 // If the player has spawned already. 272 if(this->spawned_.find(player) != this->spawned_.end()) 273 return; 274 275 this->spawned_.insert(player); 276 this->changedReadyToSpawn(player); 277 } 278 279 /** 280 @brief 281 Inform the GametypeInfo about a player whose Pawn has been killed. 282 @param player 283 The player whose Pawn has been killed. 284 */ 285 void GametypeInfo::pawnKilled(PlayerInfo* player) 286 { 287 NotificationListener::sendNotification("Press [Fire] to respawn", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID()); 288 // Remove the player from the list of players that have spawned, since it currently is not. 289 this->spawned_.erase(player); 290 } 291 292 /** 293 @brief 294 Inform the GametypeInfo about a player that has spawned. 295 @param player 296 The player that has spawned. 297 */ 298 void GametypeInfo::playerSpawned(PlayerInfo* player) 299 { 300 if(this->hasStarted() && !this->hasEnded()) 301 NotificationListener::sendCommand("clear", GametypeInfo::NOTIFICATION_SENDER, notificationSendMode::network, player->getClientID()); 70 302 } 71 303 -
code/branches/tutoriallevel2/src/orxonox/infos/GametypeInfo.h
r7163 r8450 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Damian 'Mozork' Frick 26 26 * 27 27 */ 28 29 /** 30 @file GametypeInfo.h 31 @brief Definition of the GametypeInfo class 32 */ 28 33 29 34 #ifndef _GametypeInfo_H__ … … 33 38 34 39 #include <string> 40 35 41 #include "Info.h" 36 42 37 43 namespace orxonox 38 44 { 45 46 /** 47 @brief 48 The GametypeInfo class keeps track of the state of the game and provides facilities to inform the player about it. 49 50 @author 51 Fabian 'x3n' Landau 52 @author 53 Damian 'Mozork' Frick 54 */ 39 55 class _OrxonoxExport GametypeInfo : public Info 40 56 { … … 45 61 virtual ~GametypeInfo(); 46 62 63 virtual void changedActivity(void); // Is called when the activity has changed. 64 65 /** 66 @brief Get whether the game has started yet. 67 @return Returns true if the game has started, false if not. 68 */ 47 69 inline bool hasStarted() const 48 70 { return this->bStarted_; } 71 void changedStarted(void); // Is called when the game has changed to started. 72 73 /** 74 @brief Get whether the game has ended yet. 75 @return Returns true if the game has ended, false if not. 76 */ 49 77 inline bool hasEnded() const 50 78 { return this->bEnded_; } 79 void changedEnded(void); // Is called when the game has changed to ended. 51 80 81 /** 82 @brief Get whether the start countdown is currently running. 83 @return Returns true if the countdown is running, false if not. 84 */ 52 85 inline bool isStartCountdownRunning() const 53 86 { return this->bStartCountdownRunning_; } 87 void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped. 88 89 /** 90 @brief Get the current value of the start countdown. 91 @return Returns the current value of the start countdown. 92 */ 54 93 inline float getStartCountdown() const 55 94 { return this->startCountdown_; } 95 96 /** 97 @brief Get the current start countdown counter. 98 The start countdown counter only has integer values that correspond to the actually displayed countdown. 99 @return Returns the current integer countdown counter. 100 */ 101 inline unsigned int getStartCountdownCounter() const 102 { return this->counter_; } 103 void changedCountdownCounter(void); // Is called when the start countdown counter has changed. 56 104 57 105 inline const std::string& getHUDTemplate() const … … 70 118 void dispatchStaticMessage(const std::string& message,const ColourValue& colour); 71 119 void dispatchFadingMessage(const std::string& message); 120 121 protected: 122 void changedReadyToSpawn(PlayerInfo* player); // Is called when a player has become ready to spawn. 123 124 void start(void); // Inform the GametypeInfo that the game has started. 125 void end(void); // Inform the GametypeInfo that the game has ended. 126 void setStartCountdown(float countdown); // Set the start countdown to the input value. 127 void countdownStartCountdown(float countDown); // Count down the start countdown by the specified value. 128 void countDown(); // Count down the start countdown counter. 129 void startStartCountdown(void); // Inform the GametypeInfo about the start of the start countdown. 130 void stopStartCountdown(void); // Inform the GametypeInfo about the stop of the start countdown. 131 void playerReadyToSpawn(PlayerInfo* player); // Inform the GametypeInfo about a player that is ready to spawn. 132 void pawnKilled(PlayerInfo* player); // Inform the GametypeInfo about a player whose Pawn has been killed. 133 void playerSpawned(PlayerInfo* player); // Inform the GametypeInfo about a player that has spawned. 134 135 inline void setHUDTemplate(const std::string& templateName) 136 { this->hudtemplate_ = templateName; }; 72 137 73 138 private: 74 139 void registerVariables(); 75 140 76 bool bStarted_; 77 bool bEnded_; 78 bool bStartCountdownRunning_; 79 float startCountdown_; 141 static const std::string NOTIFICATION_SENDER; //!< The name of the sender for the sending of notifications. 142 143 bool bStarted_; //!< Whether the game has started, 144 bool bEnded_; //!< Whether the game has ended. 145 bool bStartCountdownRunning_; //!< Whether the start countdown is running. 146 float startCountdown_; //!< The current value of the start countdown. 147 unsigned int counter_; //!< The current integer value of the start countdown, the start countdown counter. 80 148 std::string hudtemplate_; 149 150 std::set<PlayerInfo*> spawned_; //!< A set of players that are currently spawned. 81 151 }; 82 152 }
Note: See TracChangeset
for help on using the changeset viewer.