Changeset 9939 for code/trunk/src/orxonox/worldentities/pawns
- Timestamp:
- Dec 21, 2013, 11:16:54 PM (11 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r9667 r9939 46 46 #include "weaponsystem/WeaponPack.h" 47 47 #include "weaponsystem/WeaponSet.h" 48 #include "sound/WorldSound.h" 48 49 49 50 #include "controllers/FormationController.h" … … 100 101 101 102 this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition 103 104 if (GameMode::isMaster()) 105 { 106 this->explosionSound_ = new WorldSound(this->getContext()); 107 this->explosionSound_->setVolume(1.0f); 108 } 109 else 110 { 111 this->explosionSound_ = 0; 112 } 102 113 } 103 114 … … 109 120 this->weaponSystem_->destroy(); 110 121 } 122 111 123 } 112 124 … … 135 147 XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f); 136 148 149 XMLPortParam(Pawn, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode); 150 137 151 XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode ); 138 152 } 153 139 154 140 155 void Pawn::registerVariables() … … 290 305 void Pawn::kill() 291 306 { 292 307 this->damage(this->health_); 293 308 this->death(); 294 309 } … … 314 329 if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_)) 315 330 { 316 // Set bAlive_ to false and wait for PawnManager to do the destruction 331 explosionSound_->play(); 332 // Set bAlive_ to false and wait for PawnManager to do the destruction 317 333 this->bAlive_ = false; 318 334 … … 365 381 this->setDestroyWhenPlayerLeft(false); 366 382 367 BigExplosion* chunk = new BigExplosion(this->getContext()); 383 orxout() << "big explosion: " << this->getVelocity() << endl; 384 BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity()); 368 385 chunk->setPosition(this->getPosition()); 386 // chunk->setVelocity(this->getVelocity()); 369 387 370 388 } … … 376 394 effect->setPosition(this->getPosition()); 377 395 effect->setOrientation(this->getOrientation()); 396 effect->setVelocity(this->getVelocity()); 378 397 effect->setDestroyAfterLife(true); 379 398 effect->setSource("Orxonox/explosion2b"); … … 384 403 effect->setPosition(this->getPosition()); 385 404 effect->setOrientation(this->getOrientation()); 405 effect->setVelocity(this->getVelocity()); 386 406 effect->setDestroyAfterLife(true); 387 407 effect->setSource("Orxonox/smoke6"); … … 392 412 effect->setPosition(this->getPosition()); 393 413 effect->setOrientation(this->getOrientation()); 414 effect->setVelocity(this->getVelocity()); 394 415 effect->setDestroyAfterLife(true); 395 416 effect->setSource("Orxonox/sparks"); … … 527 548 528 549 550 void Pawn::setExplosionSound(const std::string &explosionSound) 551 { 552 if(explosionSound_ ) 553 explosionSound_->setSource(explosionSound); 554 else 555 assert(0); // This should never happen, because soundpointer is only available on master 556 } 557 558 const std::string& Pawn::getExplosionSound() 559 { 560 if( explosionSound_ ) 561 return explosionSound_->getSource(); 562 else 563 assert(0); 564 return BLANKSTRING; 565 } 566 529 567 530 568 } -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r9667 r9939 36 36 #include "interfaces/RadarViewable.h" 37 37 #include "worldentities/ControllableEntity.h" 38 38 39 39 40 namespace orxonox // tolua_export … … 178 179 virtual void changedVisibility(); 179 180 181 void setExplosionSound(const std::string& engineSound); 182 const std::string& getExplosionSound(); 183 180 184 protected: 181 185 virtual void preDestroy(); … … 231 235 232 236 Vector3 aimPosition_; 237 238 WorldSound* explosionSound_; 239 233 240 }; // tolua_export 234 241 } // tolua_export
Note: See TracChangeset
for help on using the changeset viewer.