- Timestamp:
- May 2, 2011, 5:17:20 PM (14 years ago)
- Location:
- code/branches/gameimmersion/src/orxonox/worldentities/pawns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
r8187 r8386 265 265 ////////////////////end edit 266 266 267 268 /////////////////////me override 269 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 270 { 271 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator)) 272 { 273 if (shielddamage >= this->getShieldHealth()) 274 { 275 this->setShieldHealth(0); 276 this->setHealth(this->health_ - (healthdamage + damage)); 277 } 278 else 279 { 280 this->setShieldHealth(this->shieldHealth_ - shielddamage); 281 282 // remove remaining shieldAbsorpton-Part of damage from shield 283 shielddamage = damage * this->shieldAbsorption_; 284 shielddamage = std::min(this->getShieldHealth(),shielddamage); 285 this->setShieldHealth(this->shieldHealth_ - shielddamage); 286 287 // set remaining damage to health 288 this->setHealth(this->health_ - (damage - shielddamage) - healthdamage); 289 } 290 291 this->lastHitOriginator_ = originator; 292 293 // play damage effect 294 } 295 COUT(3) << "neue damage-Funktion wurde aufgerufen // " << "Shield:" << this->getShieldHealth() << endl; 296 } 297 298 /////////////end me 299 300 301 /* HIT-Funktionen 302 Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! 303 304 */ 305 306 267 307 void Pawn::hit(Pawn* originator, const Vector3& force, float damage) 268 308 { … … 276 316 } 277 317 318 /////////////me override 319 void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage) 320 { 321 COUT(3) << "neue hit-Funktion wurde aufgerufen // " << std::flush; 322 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 323 { 324 this->damage(damage, healthdamage, shielddamage, originator); 325 this->setVelocity(this->getVelocity() + force); 326 327 // play hit effect 328 } 329 } 330 /////////////end me 331 278 332 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) 279 333 { … … 288 342 } 289 343 } 344 345 /////////////me override 346 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) 347 { 348 COUT(3) << "neue hit2-Funktion wurde aufgerufen // shielddamage: " << shielddamage << std::flush; 349 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 350 { 351 this->damage(damage, healthdamage, shielddamage, originator); 352 353 if ( this->getController() ) 354 this->getController()->hit(originator, contactpoint, shielddamage); 355 356 // play hit effect 357 } 358 } 359 /////////////end me 290 360 291 361 void Pawn::kill() -
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
r8187 r8386 127 127 virtual void hit(Pawn* originator, const Vector3& force, float damage); 128 128 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage); 129 /////////me 130 virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage); 131 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage); 132 ////////end me 129 133 virtual void kill(); 130 134 … … 183 187 184 188 virtual void damage(float damage, Pawn* originator = 0); 189 //////////me 190 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator); 191 /////////end me 185 192 186 193 bool bAlive_;
Note: See TracChangeset
for help on using the changeset viewer.