Changeset 6245 for code/branches/presentation2/src/orxonox
- Timestamp:
- Dec 4, 2009, 3:52:28 PM (15 years ago)
- Location:
- code/branches/presentation2/src/orxonox/weaponsystem
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
r6165 r6245 40 40 #include "WeaponSystem.h" 41 41 42 #include "sound/WorldSound.h" 43 42 44 namespace orxonox 43 45 { … … 67 69 this->muzzlePosition_ = Vector3::ZERO; 68 70 this->muzzleOrientation_ = Quaternion::IDENTITY; 71 72 this->defSndWpnFire_ = new WorldSound(this); 73 this->defSndWpnFire_->setLooping(false); 69 74 } 70 75 71 76 WeaponMode::~WeaponMode() 72 77 { 78 if(this->isInitialized()) 79 { 80 delete this->defSndWpnFire_; 81 } 73 82 } 74 83 … … 113 122 this->reloadTimer_.startTimer(); 114 123 124 assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() ); 125 this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->attach(this->defSndWpnFire_); 126 if(!(this->defSndWpnFire_->isPlaying())) 127 { 128 this->defSndWpnFire_->play(); 129 } 130 115 131 this->fire(); 116 132 … … 200 216 void WeaponMode::reloaded() 201 217 { 218 if(this->defSndWpnFire_->isPlaying()) 219 { 220 this->defSndWpnFire_->stop(); 221 } 202 222 this->bReloading_ = false; 203 223 } … … 228 248 return WorldEntity::FRONT; 229 249 } 250 251 void WeaponMode::setDefaultSound(const std::string& soundPath) 252 { 253 this->defSndWpnFire_->setSource(soundPath); 254 } 255 256 const std::string& WeaponMode::getDefaultSound() 257 { 258 return this->defSndWpnFire_->getSource(); 259 } 230 260 } -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.h
r6150 r6245 51 51 bool fire(float* reloadTime); 52 52 bool reload(); 53 54 // Interacting with the default Firing sound 55 void setDefaultSound(const std::string& soundPath); 56 const std::string& getDefaultSound(); 53 57 54 58 … … 160 164 Vector3 muzzlePosition_; 161 165 Quaternion muzzleOrientation_; 166 167 WorldSound* defSndWpnFire_; 162 168 }; 163 169 }
Note: See TracChangeset
for help on using the changeset viewer.