Changeset 2041 for code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/Spectator.cc
- Timestamp:
- Oct 29, 2008, 12:48:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2040 r2041 56 56 this->roll_ = 0; 57 57 this->setHudTemplate("spectatorhud"); 58 this->hudmode_ = 0; 58 59 59 60 this->setDestroyWhenPlayerLeft(true); … … 85 86 REGISTERDATA(this->bGreetingFlareVisible_, network::direction::toclient, new network::NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility)); 86 87 REGISTERDATA(this->bGreeting_, network::direction::toserver, new network::NetworkCallback<Spectator>(this, &Spectator::changedGreeting)); 88 REGISTERDATA(this->hudmode_, network::direction::toclient); 87 89 } 88 90 … … 100 102 void Spectator::tick(float dt) 101 103 { 104 this->updateHUD(); 105 102 106 if (this->isLocallyControlled()) 103 107 { 104 this->updateHUD();105 106 108 Vector3 velocity = this->getVelocity(); 107 109 velocity.normalise(); … … 187 189 { 188 190 // <hack> 189 if (this->getHUD()) 190 { 191 std::string text; 192 191 if (Core::isMaster()) 192 { 193 193 if (this->getPlayer() && this->getGametype()) 194 194 { … … 196 196 { 197 197 if (!this->getPlayer()->isReadyToSpawn()) 198 t ext = "Press [Fire] to start the match";198 this->hudmode_ = 0; 199 199 else 200 t ext = "Waiting for other players";200 this->hudmode_ = 1; 201 201 } 202 202 else if (!this->getGametype()->hasEnded()) 203 203 { 204 204 if (this->getGametype()->isStartCountdownRunning()) 205 { 206 text = convertToString(ceil(this->getGametype()->getStartCountdown())); 207 } 205 this->hudmode_ = 2 + 10*ceil(this->getGametype()->getStartCountdown()); 208 206 else 209 { 210 text = "Press [Fire] to respawn"; 211 } 207 this->hudmode_ = 3; 212 208 } 213 209 else 214 { 210 this->hudmode_ = 4; 211 } 212 else 213 return; 214 } 215 216 if (this->getHUD()) 217 { 218 std::string text; 219 int hudmode = this->hudmode_ % 10; 220 221 switch (hudmode) 222 { 223 case 0: 224 text = "Press [Fire] to start the match"; 225 break; 226 case 1: 227 text = "Waiting for other players"; 228 break; 229 case 2: 230 text = convertToString((this->hudmode_ - 2) / 10); 231 break; 232 case 3: 233 text = "Press [Fire] to respawn"; 234 break; 235 case 4: 215 236 text = "Game has ended"; 216 } 217 } 218 else 219 { 220 return; 237 break; 238 default:; 221 239 } 222 240
Note: See TracChangeset
for help on using the changeset viewer.