Changeset 9889 for code/branches/sfxThilo/src/orxonox/worldentities/pawns
- Timestamp:
- Dec 9, 2013, 4:06:38 PM (11 years ago)
- Location:
- code/branches/sfxThilo/src/orxonox/worldentities/pawns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.cc
r9667 r9889 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 … … 527 543 528 544 545 void Pawn::setExplosionSound(const std::string &explosionSound) 546 { 547 if(explosionSound_ ) 548 explosionSound_->setSource(explosionSound); 549 else 550 assert(0); // This should never happen, because soundpointer is only available on master 551 } 552 553 const std::string& Pawn::getExplosionSound() 554 { 555 if( explosionSound_ ) 556 return explosionSound_->getSource(); 557 else 558 assert(0); 559 return BLANKSTRING; 560 } 561 529 562 530 563 } -
code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.h
r9667 r9889 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.