Changeset 7636 for code/branches/lastmanstanding/src
- Timestamp:
- Nov 11, 2010, 1:35:49 AM (14 years ago)
- Location:
- code/branches/lastmanstanding/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding/src/modules/overlays/OverlaysPrereqs.h
r7163 r7636 88 88 class HUDTimer; 89 89 class KillMessage; 90 class LastManStandingInfos; 90 91 class TeamBaseMatchScore; 91 92 class UnderAttackHealthBar; -
code/branches/lastmanstanding/src/modules/overlays/hud/LastManStandingInfos.cc
r7635 r7636 43 43 RegisterObject(LastManStandingInfos); 44 44 45 this->owner_ = 0; 45 this->lms_ = 0; 46 this->player_ = 0; 46 47 this->bShowLives_ = false; 47 48 this->bShowPlayers_ = false; … … 64 65 SUPER(LastManStandingInfos, tick, dt); 65 66 66 if (this-> owner_)67 if (this->player_ && this->lms_) 67 68 { 68 69 Pawn* pawn = dynamic_cast<Pawn*>(this->getOwner()->getControllableEntity());70 /*LastManStanding* */ owner_ = dynamic_cast<LastManStanding*>(this->getOwner()->getGametype());71 int iLives = this->owner_->pawnGetLives(pawn);72 const std::string& lives = multi_cast<std::string>(iLives);73 74 const std::string& players = multi_cast<std::string>(this->owner_->playersAlive);75 76 69 if (this->bShowLives_) 77 70 { 71 const std::string& lives = multi_cast<std::string>(this->lms_->playerGetLives(this->player_)); 78 72 this->setCaption(lives); 79 73 } 80 74 else if(this->bShowPlayers_) 81 75 { 76 const std::string& players = multi_cast<std::string>(this->lms_->getNumPlayersAlive()); 82 77 this->setCaption(players); 83 78 } 84 79 } 85 80 } 81 82 void LastManStandingInfos::changedOwner() 83 { 84 SUPER(LastManStandingInfos, changedOwner); 85 86 if (this->getOwner() && this->getOwner()->getGametype()) 87 { 88 this->player_ = orxonox_cast<PlayerInfo*>(this->getOwner()); 89 this->lms_ = orxonox_cast<LastManStanding*>(this->getOwner()->getGametype().get()); 90 } 91 else 92 { 93 this->player_ = 0; 94 this->lms_ = 0; 95 } 96 } 86 97 } -
code/branches/lastmanstanding/src/modules/overlays/hud/LastManStandingInfos.h
r7635 r7636 45 45 virtual void tick(float dt); 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 virtual void changedOwner(); 47 48 48 49 inline void setShowLives(bool value) … … 57 58 58 59 private: 59 LastManStanding* owner_; 60 LastManStanding* lms_; 61 PlayerInfo* player_; 60 62 bool bShowLives_; 61 63 bool bShowPlayers_; -
code/branches/lastmanstanding/src/orxonox/OrxonoxPrereqs.h
r7163 r7636 93 93 class Dynamicmatch; 94 94 class Gametype; 95 class LastManStanding; 95 96 class TeamBaseMatch; 96 97 class TeamDeathmatch; -
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
r7635 r7636 147 147 } 148 148 149 int LastManStanding::pawnGetLives(Pawn* pawn) 150 { 151 if(!pawn) 152 return -1; 153 PlayerInfo* player= dynamic_cast<PlayerInfo*>(pawn); 154 if(!player) 155 return -2; 156 return playerLives_[player]; 157 } 158 159 const int LastManStanding::playerGetLives(PlayerInfo* player) 149 int LastManStanding::playerGetLives(PlayerInfo* player) 160 150 { 161 151 if (player) … … 163 153 else 164 154 return 0; 155 } 156 157 int LastManStanding::getNumPlayersAlive() const 158 { 159 return this->playersAlive; 165 160 } 166 161 -
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
r7635 r7636 73 73 74 74 virtual void end(); //!< Sends an end message. 75 virtual int pawnGetLives(Pawn* pawn); //!< Returns amount of Lives of a certain player.76 const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".75 int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_". 76 int getNumPlayersAlive() const; //!< Returns the number of players that are still alive. 77 77 virtual void playerEntered(PlayerInfo* player); //!< Initializes values. Manages the gametype's HUD. #Players alive via StaticMessage. 78 78 virtual bool playerLeft(PlayerInfo* player); //!< Manages the gametype's HUD. #Players alive via StaticMessage.
Note: See TracChangeset
for help on using the changeset viewer.