Changeset 8386 for code/branches/gameimmersion/src
- Timestamp:
- May 2, 2011, 5:17:20 PM (14 years ago)
- Location:
- code/branches/gameimmersion/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
r8183 r8386 48 48 this->bDestroy_ = false; 49 49 this->owner_ = 0; 50 this->damage_ = 15; 50 this->damage_ = 115; 51 ///////////////////me 52 this->healthdamage_ = 0; 53 this->shielddamage_ = 0; 54 ///////////////////end me 51 55 52 56 // Get notification about collisions … … 139 143 if (victim) 140 144 { 141 victim->hit(this->owner_, contactPoint, this->damage_ );145 victim->hit(this->owner_, contactPoint, this->damage_, this->healthdamage_, this->shielddamage_); 142 146 victim->startReloadCountdown(); 143 147 } -
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h
r5929 r8386 50 50 51 51 inline void setDamage(float damage) 52 { this->damage_ = damage; }52 { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION WIRD AUFGERUFEN" << endl; } 53 53 inline float getDamage() const 54 54 { return this->damage_; } … … 58 58 { return this->owner_; } 59 59 60 ////////////////////me 61 62 inline void setHealthDamage(float healthdamage) 63 { this->healthdamage_ = healthdamage; } 64 inline float getHealthDamage() const 65 { return this->healthdamage_; } 66 67 inline void setShieldDamage(float shielddamage) 68 { this->shielddamage_ = shielddamage; COUT(3) << "SHIELDDAMAGE SET TO " << shielddamage << endl; } //ShieldDamage wird korrekt gesettet vom XML-File 69 inline float getShieldDamage() const 70 { return this->shielddamage_; } 71 72 ///////////////////end me 73 74 60 75 private: 61 76 WeakPtr<Pawn> owner_; 62 77 float lifetime_; 63 78 float damage_; 79 ///////me 80 float healthdamage_; 81 float shielddamage_; 82 ///////end me 64 83 bool bDestroy_; 65 84 Timer destroyTimer_; -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc
r6732 r8386 69 69 projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 70 70 projectile->setDamage(this->getDamage()); 71 projectile->setShieldDamage(this->getShieldDamage()); 71 72 } 72 73 } -
code/branches/gameimmersion/src/orxonox/controllers/Controller.h
r6417 r8386 52 52 virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {}; 53 53 54 /* Override needed for different visual effects (e.g. in "NewHumanController.cc") depending on 55 the DIFFERENT AMOUNT OF DAMAGE done to the shield and to the health of "victim" (see Projectile.cc, Pawn.cc) 56 57 // virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) {}; 58 */ 59 54 60 void setGodMode( bool mode ){ this->bGodMode_ = mode; } 55 61 bool getGodMode(){ return this->bGodMode_; } -
code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.cc
r7847 r8386 66 66 67 67 this->damage_ = 0; 68 68 ///////////////////me 69 this->healthdamage_ = 0; 70 this->shielddamage_ = 0; 71 ///////////////////end me 69 72 this->muzzleOffset_ = Vector3::ZERO; 70 73 this->muzzlePosition_ = Vector3::ZERO; … … 106 109 107 110 XMLPortParam(WeaponMode, "damage", setDamage, getDamage, xmlelement, mode); 111 //////////me 112 XMLPortParam(WeaponMode, "healthdamage", setHealthDamage, getHealthDamage, xmlelement, mode); 113 XMLPortParam(WeaponMode, "shielddamage", setShieldDamage, getShieldDamage, xmlelement, mode); 114 /////////end me 108 115 XMLPortParam(WeaponMode, "muzzleoffset", setMuzzleOffset, getMuzzleOffset, xmlelement, mode); 109 116 } -
code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.h
r7163 r8386 104 104 // Fire 105 105 inline void setDamage(float damage) 106 { this->damage_ = damage; }106 { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION (WeaponMode) WIRD AUFGERUFEN" << endl;} 107 107 inline float getDamage() const 108 108 { return this->damage_; } 109 ////////////////////me, copied to projectile.cc 109 110 111 inline void setHealthDamage(float healthdamage) 112 { this->healthdamage_ = healthdamage; } 113 inline float getHealthDamage() const 114 { return this->healthdamage_; } 115 116 inline void setShieldDamage(float shielddamage) 117 { this->shielddamage_ = shielddamage;} //ShieldDamage wird korrekt gesettet vom XML-File 118 inline float getShieldDamage() const 119 { return this->shielddamage_; } 120 121 ///////////////////end me 110 122 inline void setMuzzleOffset(const Vector3& offset) 111 123 { this->muzzleOffset_ = offset; } … … 146 158 147 159 float damage_; 160 float healthdamage_; 161 float shielddamage_; 148 162 Vector3 muzzleOffset_; 149 163 -
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.