- Timestamp:
- May 23, 2011, 6:41:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
r8551 r8553 152 152 this->bReload_ = false; 153 153 154 ////////me 154 // TODO: use the existing timer functions instead 155 155 if(this->reloadWaitCountdown_ > 0) 156 156 { … … 163 163 } 164 164 165 ////////end me166 165 if (GameMode::isMaster()) 166 { 167 167 if (this->health_ <= 0 && bAlive_) 168 168 { … … 170 170 this->death(); 171 171 } 172 } 172 173 } 173 174 … … 195 196 } 196 197 197 //////////////////me 198 199 void Pawn::setHealth(float health) 200 { 201 this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit 202 } 203 204 void Pawn::setShieldHealth(float shieldHealth) 205 { 206 this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_); 207 } 208 209 void Pawn::setMaxShieldHealth(float maxshieldhealth) 210 { 211 this->maxShieldHealth_ = maxshieldhealth; 212 } 213 198 214 void Pawn::setReloadRate(float reloadrate) 199 215 { 200 216 this->reloadRate_ = reloadrate; 201 //COUT(2) << "RELOAD RATE SET TO " << this->reloadRate_ << endl;202 217 } 203 218 … … 205 220 { 206 221 this->reloadWaitTime_ = reloadwaittime; 207 //COUT(2) << "RELOAD WAIT TIME SET TO " << this->reloadWaitTime_ << endl;208 222 } 209 223 … … 213 227 } 214 228 215 void Pawn::setMaxShieldHealth(float maxshieldhealth) 216 { 217 this->maxShieldHealth_ = maxshieldhealth; 218 } 219 220 void Pawn::setShieldHealth(float shieldHealth) 221 { 222 this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_); 223 } 224 225 ///////////////end me 226 227 void Pawn::setHealth(float health) 228 { 229 this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit 230 } 231 232 //////////////////me edit 229 /* Old damage function. 230 * For effects causing only damage not specifically to shield or health 231 */ 233 232 void Pawn::damage(float damage, Pawn* originator) 234 233 { 235 COUT(3) << "### alte damage-funktion ###" << endl;236 234 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator)) 237 235 { … … 247 245 } 248 246 249 // else { COUT(3) << "## SHIELD : " << this->getShieldHealth() << endl; }250 251 247 this->setHealth(this->health_ - healthdamage); 252 248 … … 261 257 } 262 258 } 263 ////////////////////end edit 264 265 266 /////////////////////me override 259 260 /* Does damage to the pawn, splits it up to shield and health. 261 * Sets lastHitOriginator. 262 */ 267 263 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 268 264 { … … 291 287 // play damage effect 292 288 } 293 //COUT(3) << "neue damage-Funktion wurde aufgerufen // " << "Shield:" << this->getShieldHealth() << endl; 294 } 295 296 /////////////end me 289 } 297 290 298 291 299 292 /* HIT-Funktionen 300 Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! 293 Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte) 301 294 302 295 */ 303 296 304 297 /* Old hit function, calls the old damage function and changes velocity vector 298 */ 305 299 void Pawn::hit(Pawn* originator, const Vector3& force, float damage) 306 300 { … … 314 308 } 315 309 316 /////////////me override 310 /* calls the damage function and adds the force that hit the pawn to the velocity vector 311 */ 317 312 void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage) 318 313 { 319 // COUT(3) << "neue hit-Funktion wurde aufgerufen // " << std::flush;320 314 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 321 315 { … … 326 320 } 327 321 } 328 /////////////end me 329 322 323 /* Old hit (2) function, calls the old damage function and hits controller 324 */ 330 325 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) 331 326 { … … 341 336 } 342 337 343 /////////////me override 338 /* Hit (2) function, calls the damage function and hits controller 339 */ 344 340 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) 345 341 { 346 // COUT(3) << "neue hit2-Funktion wurde aufgerufen // shielddamage: " << shielddamage << std::flush;347 342 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 348 343 { … … 350 345 351 346 if ( this->getController() ) 352 this->getController()->hit(originator, contactpoint, shielddamage);347 this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage? 353 348 354 349 // play hit effect 355 350 } 356 351 } 357 /////////////end me 352 358 353 359 354 void Pawn::kill()
Note: See TracChangeset
for help on using the changeset viewer.