Changeset 2818
- Timestamp:
- Mar 22, 2009, 9:40:35 PM (16 years ago)
- Location:
- code/branches/miniprojects/src/orxonox/objects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.cc
r2768 r2818 176 176 } 177 177 178 void Gametype::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) 179 { 180 } 181 182 void Gametype::playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn) 183 { 184 } 185 178 186 bool Gametype::allowPawnHit(Pawn* victim, Pawn* originator) 179 187 { -
code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.h
r2789 r2818 101 101 virtual void playerPostSpawn(PlayerInfo* player); 102 102 103 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); 104 virtual void playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn); 105 103 106 inline const std::map<PlayerInfo*, Player>& getPlayers() const 104 107 { return this->players_; } -
code/branches/miniprojects/src/orxonox/objects/gametypes/TeamGametype.cc
r2768 r2818 34 34 #include "objects/Teamcolourable.h" 35 35 #include "objects/worldentities/TeamSpawnPoint.h" 36 #include "objects/infos/PlayerInfo.h" // remove this37 36 38 37 namespace orxonox … … 151 150 } 152 151 153 void TeamGametype::player PostSpawn(PlayerInfo* player)152 void TeamGametype::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) 154 153 { 155 154 if (!player) … … 160 159 if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < this->teamcolours_.size()) 161 160 { 162 if (p layer->getControllableEntity())161 if (pawn) 163 162 { 164 std::set<WorldEntity*> pawnAttachments = p layer->getControllableEntity()->getAttachedObjects();163 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 165 164 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it) 166 165 { -
code/branches/miniprojects/src/orxonox/objects/gametypes/TeamGametype.h
r2768 r2818 53 53 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); 54 54 55 virtual void player PostSpawn(PlayerInfo* player);55 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); 56 56 57 57 protected: -
code/branches/miniprojects/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2768 r2818 133 133 } 134 134 135 void Pawn::setPlayer(PlayerInfo* player) 136 { 137 ControllableEntity::setPlayer(player); 138 139 if (this->getGametype()) 140 this->getGametype()->playerStartsControllingPawn(player, this); 141 } 142 143 void Pawn::removePlayer() 144 { 145 if (this->getGametype()) 146 this->getGametype()->playerStopsControllingPawn(this->getPlayer(), this); 147 148 ControllableEntity::removePlayer(); 149 } 150 135 151 void Pawn::setHealth(float health) 136 152 { -
code/branches/miniprojects/src/orxonox/objects/worldentities/pawns/Pawn.h
r2662 r2818 47 47 virtual void tick(float dt); 48 48 void registerVariables(); 49 50 virtual void setPlayer(PlayerInfo* player); 51 virtual void removePlayer(); 49 52 50 53 inline bool isAlive() const
Note: See TracChangeset
for help on using the changeset viewer.