Changeset 7039 in orxonox.OLD for trunk/src/util/multiplayer_team_deathmatch.cc
- Timestamp:
- Feb 6, 2006, 12:47:01 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/multiplayer_team_deathmatch.cc
r7037 r7039 20 20 #include "factory.h" 21 21 22 #include "render2D/billboard.h" 23 #include "state.h" 24 22 25 23 26 using namespace std; … … 37 40 this->bLocalPlayerDead = false; 38 41 this->deathTimeout = 10.0f; // 5 seconds 42 this->deathScreen = new Billboard(); 43 this->deathScreen->setSize(State::getResX(), State::getResY()); 39 44 40 45 if( root != NULL) … … 59 64 LoadParam(root, "max-kills", this, MultiplayerTeamDeathmatch, setMaxKills) 60 65 .describe("sets the maximal kills for winning condition"); 66 67 LoadParam(root, "death-screen-image", this, MultiplayerTeamDeathmatch, setDeathScreen) 68 .describe("sets the death screen image"); 69 61 70 } 71 72 73 74 void MultiplayerTeamDeathmatch::setDeathScreen(const char* imageName) 75 { 76 if( this->deathScreen) 77 this->deathScreen->setTexture(imageName); 78 } 79 62 80 63 81 … … 67 85 */ 68 86 void MultiplayerTeamDeathmatch::onPlayerSpawn(Player* player) 69 {} 87 { 88 this->bLocalPlayerDead = true; 89 } 70 90 71 91 … … 75 95 */ 76 96 void MultiplayerTeamDeathmatch::onPlayerDeath(Player* player) 77 {} 97 { 98 this->localPlayer = player; 99 this->bLocalPlayerDead = true; 100 } 78 101 79 102 … … 84 107 void MultiplayerTeamDeathmatch::tick(float dt) 85 108 { 109 this->checkGameRules(); 86 110 111 // is the local player dead and inactive 112 if( unlikely(this->bLocalPlayerDead)) 113 { 114 this->timeout += dt; 115 116 // long enough dead? 117 if( dt >= this->deathTimeout) 118 { 119 this->timeout = 0.0f; 120 121 // respawn 122 } 123 } 87 124 } 88 125 … … 92 129 */ 93 130 void MultiplayerTeamDeathmatch::draw() 94 {} 131 { 132 if( unlikely( this->bLocalPlayerDead)) 133 { 134 135 } 136 } 95 137 96 138 … … 99 141 */ 100 142 void MultiplayerTeamDeathmatch::checkGameRules() 101 {} 143 { 144 // 145 // check for max killing count 146 if( this->teamAKills >= this->maxKills) 147 { 148 // team A winns 149 } 150 else if( this->teamBKills >= this->maxKills) 151 { 152 // team B winns 153 } 154 } 102 155 103 156
Note: See TracChangeset
for help on using the changeset viewer.