Changeset 7636 for code/branches/lastmanstanding/src/modules
- Timestamp:
- Nov 11, 2010, 1:35:49 AM (14 years ago)
- Location:
- code/branches/lastmanstanding/src/modules/overlays
- Files:
-
- 3 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_;
Note: See TracChangeset
for help on using the changeset viewer.