- Timestamp:
- Dec 4, 2009, 3:52:28 PM (15 years ago)
- Location:
- code/branches/presentation2/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/weapons/weaponmodes/HsW01.cc
r6227 r6245 52 52 RegisterObject(HsW01); 53 53 54 this->reloadTime_ = 0. 5;54 this->reloadTime_ = 0.25; 55 55 this->damage_ = 15; 56 56 this->speed_ = 2500; … … 61 61 this->delayTimer_.stopTimer(); 62 62 63 this->defSndWpnFire_ = new WorldSound(this); 64 this->defSndWpnFire_->setLooping(false); 65 this->setDefaultSound("sounds/Weapon_Laser_shrt.ogg"); 63 this->setDefaultSound("sounds/Weapon_HsW01.ogg"); 66 64 } 67 65 68 66 HsW01::~HsW01() 69 67 { 70 if(this->isInitialized())71 {72 delete this->defSndWpnFire_;73 }74 68 } 75 69 … … 106 100 void HsW01::fire() 107 101 { 108 this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->attach(this->defSndWpnFire_);109 this->defSndWpnFire_->play();110 111 102 this->delayTimer_.startTimer(); 112 113 //this->defSndWpnFire_->stop();114 103 } 115 104 … … 142 131 HsW01::muendungsfeuer(); 143 132 } 144 145 void HsW01::setDefaultSound(const std::string& soundPath)146 {147 this->defSndWpnFire_->setSource(soundPath);148 }149 150 const std::string& HsW01::getDefaultSound()151 {152 return this->defSndWpnFire_->getSource();153 }154 133 } -
code/branches/presentation2/src/modules/weapons/weaponmodes/HsW01.h
r6227 r6245 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 47 48 void setDefaultSound(const std::string& soundPath);49 const std::string& getDefaultSound();50 51 48 private: 52 49 void setMaterial(const std::string& material); … … 61 58 float delay_; 62 59 Timer delayTimer_; 63 64 WorldSound* defSndWpnFire_;65 60 }; 66 61 } -
code/branches/presentation2/src/modules/weapons/weaponmodes/LightningGun.cc
r6154 r6245 36 36 #include "worldentities/pawns/Pawn.h" 37 37 38 #include "sound/WorldSound.h" 39 38 40 namespace orxonox 39 41 { … … 49 51 50 52 this->setMunitionName("LaserMunition"); 53 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 51 54 } 52 55 … … 56 59 57 60 void LightningGun::fire() 58 { 61 { 59 62 LightningGunProjectile* projectile = new LightningGunProjectile(this); 60 63 projectile->setMaterial("Flares/LightningBall_"); -
code/branches/presentation2/src/modules/weapons/weaponmodes/LightningGun.h
r5781 r6245 42 42 43 43 virtual void fire(); 44 44 45 private: 45 46 float speed_; -
code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.cc
r6153 r6245 38 38 #include "worldentities/pawns/Pawn.h" 39 39 40 #include "sound/WorldSound.h" 41 40 42 namespace orxonox 41 43 { … … 52 54 53 55 this->setMunitionName("RocketMunition"); 56 this->setDefaultSound("sounds/Rocket_Launch.ogg"); 57 } 58 59 RocketFire::~RocketFire() 60 { 54 61 } 55 62 -
code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.h
r6107 r6245 39 39 public: 40 40 RocketFire(BaseObject* creator); 41 virtual ~RocketFire() {}41 virtual ~RocketFire(); 42 42 43 43 virtual void fire(); -
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.