- Timestamp:
- May 25, 2011, 9:07:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
r8575 r8577 130 130 XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0); 131 131 XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f); 132 133 //TODO: DEFINES fuer defaultwerte (hier und weiter oben dieselben)134 132 } 135 133 … … 227 225 } 228 226 229 /* Old damage function.230 * For effects causing only damage not specifically to shield or health231 */232 void Pawn::damage(float damage, Pawn* originator)233 {234 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))235 {236 //share the dealt damage to the shield and the Pawn.237 float shielddamage = damage*this->shieldAbsorption_;238 float healthdamage = damage*(1-this->shieldAbsorption_);239 240 // In case the shield can not take all the shield damage.241 if (shielddamage > this->getShieldHealth())242 {243 healthdamage += shielddamage-this->getShieldHealth();244 this->setShieldHealth(0);245 }246 247 this->setHealth(this->health_ - healthdamage);248 249 if (this->getShieldHealth() > 0)250 {251 this->setShieldHealth(this->shieldHealth_ - shielddamage);252 }253 254 this->lastHitOriginator_ = originator;255 256 // play damage effect257 }258 }259 260 /* Does damage to the pawn, splits it up to shield and health.261 * Sets lastHitOriginator.262 */263 227 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 264 228 { … … 284 248 285 249 this->lastHitOriginator_ = originator; 286 287 // play damage effect 288 } 289 } 290 291 250 } 251 } 252 253 // TODO: Still valid? 292 254 /* HIT-Funktionen 293 255 Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte) … … 295 257 */ 296 258 297 /* Old hit function, calls the old damage function and changes velocity vector298 */299 void Pawn::hit(Pawn* originator, const Vector3& force, float damage)300 {301 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )302 {303 this->damage(damage, originator);304 this->setVelocity(this->getVelocity() + force);305 306 // play hit effect307 }308 }309 310 /* calls the damage function and adds the force that hit the pawn to the velocity vector311 */312 259 void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage) 313 260 { … … 316 263 this->damage(damage, healthdamage, shielddamage, originator); 317 264 this->setVelocity(this->getVelocity() + force); 318 319 // play hit effect 320 } 321 } 322 323 /* Old hit (2) function, calls the old damage function and hits controller 324 */ 325 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) 326 { 327 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 328 { 329 this->damage(damage, originator); 330 331 if ( this->getController() ) 332 this->getController()->hit(originator, contactpoint, damage); 333 334 // play hit effect 335 } 336 } 337 338 /* Hit (2) function, calls the damage function and hits controller 339 */ 265 } 266 } 267 268 340 269 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) 341 270 { … … 346 275 if ( this->getController() ) 347 276 this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage? 348 349 // play hit effect350 277 } 351 278 }
Note: See TracChangeset
for help on using the changeset viewer.