Changeset 11108 for code/trunk/src/modules/weapons
- Timestamp:
- Feb 4, 2016, 11:54:04 PM (9 years ago)
- Location:
- code/trunk/src/modules/weapons
- Files:
-
- 6 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/munitions/CMakeLists.txt
r11052 r11108 6 6 GravityBombMunition.cc 7 7 IceMunition.cc 8 FlameMunition.cc 8 9 SplitMunition.cc 9 10 MineMunition.cc -
code/trunk/src/modules/weapons/munitions/LaserMunition.cc
r11071 r11108 55 55 this->replenishAmount_ = 1; 56 56 57 this->reloadTime_ = 0. 5f;57 this->reloadTime_ = 0.6f; 58 58 } 59 59 } -
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
r11099 r11108 54 54 this->bDestroy_ = false; 55 55 56 // Default is destroying the projectile after collision 57 this->destroyAfterCollision_ = true; 58 56 59 // Default damage must be zero, otherwise it would be above zero if no settings are made in the weaponsettings xml file. 57 60 // same thing for all weaponmodes files … … 87 90 return false; 88 91 89 this->bDestroy_ = true; // If something is hit, the object is destroyed and can't hit something else. 90 // The projectile is destroyed by its tick()-function (in the following tick). 92 if (getDestroyAfterCollision()) 93 { 94 this->bDestroy_ = true; // If something is hit, the object is destroyed and can't hit something else. 95 // The projectile is destroyed by its tick()-function (in the following tick). 96 // TODO: Use destroyLater() for this 97 } 91 98 92 99 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is nullptr -
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
r11099 r11108 119 119 bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs); 120 120 void destroyCheck(void); 121 inline void setDestroyAfterCollision(bool destroyAfterCollision) 122 { destroyAfterCollision_ = destroyAfterCollision; } 123 inline bool getDestroyAfterCollision() const 124 { return destroyAfterCollision_; } 121 125 122 126 private: … … 130 134 131 135 bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed. 136 bool destroyAfterCollision_; //!< Boolean, defines whether the projectile gets detroyed after a collision. 132 137 }; 133 138 } -
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
r11052 r11108 7 7 SplitGunProjectile.cc 8 8 IceGunProjectile.cc 9 FlameGunProjectile.cc 9 10 Rocket.cc 10 11 RocketOld.cc -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
r11071 r11108 47 47 48 48 this->textureIndex_ = 1; 49 this->setMass( 2);49 this->setMass(0.1f); 50 50 this->setCollisionType(CollisionType::Dynamic); 51 51 this->maxTextureIndex_ = 8; -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
r11071 r11108 43 43 RegisterClass(ParticleProjectile); 44 44 45 ParticleProjectile::ParticleProjectile(Context* context) : BillboardProjectile(context)45 ParticleProjectile::ParticleProjectile(Context* context) : Projectile(context) 46 46 { 47 47 RegisterObject(ParticleProjectile); 48 48 49 if (GameMode::showsGraphics()) 50 { 51 // Create the particles. 52 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::Normal); 53 this->attachOgreObject(this->particles_->getParticleSystem()); 54 this->particles_->setKeepParticlesInLocalSpace(0); 49 this->particles_ = nullptr; 55 50 56 for (unsigned int i = 0; i < this->particles_->getNumEmitters(); ++i) 57 this->particles_->getEmitter(i)->setDirection(-WorldEntity::FRONT); 58 } 59 else 60 this->particles_ = nullptr; 51 //setEffect("Orxonox/sparks2"); 61 52 } 62 53 … … 82 73 this->particles_->setEnabled(this->isVisible()); 83 74 } 75 76 void ParticleProjectile::setEffect(const std::string& effect) 77 { 78 // If we already have a particle interface, delete it 79 if (this->particles_) 80 { 81 this->detachOgreObject(this->particles_->getParticleSystem()); 82 delete this->particles_; 83 this->particles_ = nullptr; 84 } 85 86 if (GameMode::showsGraphics()) 87 { 88 // Create the particles. 89 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), effect, LODParticle::Normal); 90 this->attachOgreObject(this->particles_->getParticleSystem()); 91 this->particles_->setKeepParticlesInLocalSpace(0); 92 93 for (unsigned int i = 0; i < this->particles_->getNumEmitters(); ++i) 94 this->particles_->getEmitter(i)->setDirection(-WorldEntity::FRONT); 95 } 96 else 97 { 98 this->particles_ = nullptr; 99 } 100 } 84 101 } -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
r11071 r11108 48 48 @ingroup WeaponsProjectiles 49 49 */ 50 class _WeaponsExport ParticleProjectile : public BillboardProjectile50 class _WeaponsExport ParticleProjectile : public Projectile 51 51 { 52 52 public: … … 54 54 virtual ~ParticleProjectile(); 55 55 virtual void changedVisibility() override; 56 virtual void setEffect(const std::string& effect); 56 57 57 58 private: -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r11071 r11108 54 54 if (GameMode::isMaster()) 55 55 { 56 this->setMass( 1.0f);56 this->setMass(0.1f); 57 57 this->enableCollisionCallback(); 58 58 this->setCollisionResponse(false); -
code/trunk/src/modules/weapons/projectiles/SplitGunProjectile.cc
r11099 r11108 52 52 this->spread_ = 0.2f; 53 53 this->damageReduction_ = 1.0f; 54 this->splitSound_ = nullptr; 55 56 this->setSplitSound("sounds/Weapon_SplitGun.ogg", 0.8); 57 } 58 59 SplitGunProjectile::~SplitGunProjectile() 60 { 61 if (this->isInitialized()) 62 { 63 if (splitSound_) 64 { 65 splitSound_->destroy(); 66 } 67 } 54 68 } 55 69 … … 158 172 159 173 numberOfSplits_ = 0; 174 175 if (splitSound_) 176 { 177 splitSound_->play(); 178 } 160 179 } 161 180 } 181 182 void SplitGunProjectile::setSplitSound(const std::string& soundPath, const float soundVolume) 183 { 184 if (!splitSound_) 185 { 186 this->splitSound_ = new WorldSound(this->getContext()); 187 this->splitSound_->setLooping(false); 188 this->attach(splitSound_); 189 } 190 191 this->splitSound_->setSource(soundPath); 192 this->splitSound_->setVolume(soundVolume); 193 } 162 194 } -
code/trunk/src/modules/weapons/projectiles/SplitGunProjectile.h
r11052 r11108 28 28 29 29 /** 30 @file IceGunProjectile.h30 @file SplitGunProjectile.h 31 31 @brief Definition of the SplitGunProjectile class. 32 32 */ … … 40 40 #include "tools/Timer.h" 41 41 #include "BillboardProjectile.h" 42 #include "sound/WorldSound.h" 42 43 43 44 namespace orxonox … … 55 56 public: 56 57 SplitGunProjectile(Context* context); 57 virtual ~SplitGunProjectile() {}58 virtual ~SplitGunProjectile(); 58 59 59 60 virtual void setNumberOfSplits(int numberOfSplits); … … 62 63 virtual void setSpread(float spread); 63 64 virtual void setDamageReduction(float damageReduction); 65 virtual void setSplitSound(const std::string& soundPath, const float soundVolume = 1.0); 64 66 65 67 private: … … 70 72 float damageReduction_; //The damage of a child projectile is reduced by this factor 71 73 Timer splitTimer_; 74 WorldSound* splitSound_; //Sound played if the projectile splits 72 75 73 76 virtual void split(); -
code/trunk/src/modules/weapons/weaponmodes/CMakeLists.txt
r11052 r11108 7 7 SplitGun.cc 8 8 IceGun.cc 9 FlameGun.cc 9 10 RocketFire.cc 10 11 RocketFireOld.cc -
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
r11052 r11108 59 59 this->speed_ = 750.0f; 60 60 this->delay_ = 0.0f; 61 this->timerStarted_ = false; 61 62 this->setMunitionName("FusionMunition"); 63 this->setFireSound("sounds/Weapon_EnergyDrink.ogg"); 62 64 63 65 this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&EnergyDrink::shot, this))); … … 93 95 void EnergyDrink::fire() 94 96 { 95 this->delayTimer_.startTimer(); 97 if (!timerStarted_) 98 { 99 this->delayTimer_.startTimer(); 100 this->timerStarted_ = true; 101 } 102 } 103 104 bool EnergyDrink::fire(float* reloadTime) 105 { 106 if (!timerStarted_) 107 { 108 return WeaponMode::fire(reloadTime); 109 } 110 111 return false; 96 112 } 97 113 … … 102 118 void EnergyDrink::shot() 103 119 { 120 this->timerStarted_ = false; 121 104 122 // Create the projectile 105 123 Projectile* projectile = new Projectile(this->getContext()); -
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
r11071 r11108 57 57 virtual ~EnergyDrink() {} 58 58 59 virtual bool fire(float* reloadTime) override; 59 60 virtual void fire() override; 60 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; … … 89 90 float delay_; //!< The firing delay. 90 91 Timer delayTimer_; //!< The timer to delay the firing. 92 bool timerStarted_; 91 93 }; 92 94 } -
code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
r11052 r11108 58 58 59 59 this->setMunitionName("FusionMunition"); 60 this->setFireSound("sounds/Weapon_FusionFire.ogg"); 60 61 61 62 hudImageString_ = "Orxonox/WSHUD_WM_FusionFire"; -
code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.cc
r11052 r11108 30 30 31 31 this->setMunitionName("GravityBombMunition"); 32 this->set DefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.8); ///< sets sound of the bomb as it is fired.32 this->setFireSound("sounds/Rocket_launch.ogg",0.8); ///< sets sound of the bomb as it is fired. 33 33 34 34 hudImageString_ = "Orxonox/WSHUD_WM_GravityBombFire"; -
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
r11052 r11108 62 62 this->setMunitionName("LaserMunition"); 63 63 this->mesh_ = "laserbeam.mesh"; 64 this->sound_ = "sounds/Weapon_HsW01.ogg";65 64 66 65 … … 68 67 this->delayTimer_.stopTimer(); 69 68 70 this->setDefaultSound(this->sound_); 69 this->setFireSound("sounds/Weapon_HsW01.ogg"); 70 this->setReloadSound("sounds/Reload_HsW01.ogg", 0.5); 71 71 72 72 hudImageString_ = "Orxonox/WSHUD_WM_HsW01"; -
code/trunk/src/modules/weapons/weaponmodes/IceGun.cc
r11052 r11108 60 60 61 61 this->setMunitionName("IceMunition"); 62 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 62 this->setFireSound("sounds/Weapon_LightningGun.ogg"); 63 this->setReloadSound("sounds/Reload_IceGun.ogg", 0.4); 63 64 64 65 hudImageString_ = "Orxonox/WSHUD_WM_IceGun"; -
code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
r11052 r11108 41 41 #include "worldentities/pawns/Pawn.h" 42 42 43 #include "weapons/projectiles/ ParticleProjectile.h"43 #include "weapons/projectiles/BillboardProjectile.h" 44 44 45 45 namespace orxonox … … 56 56 57 57 this->setMunitionName("LaserMunition"); 58 this->setFireSound("sounds/Weapon_LaserFire.ogg"); 59 this->setReloadSound("sounds/Reload_LaserFire.ogg", 0.8); 58 60 59 61 hudImageString_ = "Orxonox/WSHUD_WM_LaserFire"; … … 66 68 void LaserFire::fire() 67 69 { 68 ParticleProjectile* projectile = new ParticleProjectile(this->getContext());70 BillboardProjectile* projectile = new BillboardProjectile(this->getContext()); 69 71 70 72 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); -
code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
r11052 r11108 55 55 56 56 this->setMunitionName("LightningMunition"); 57 this->set DefaultSound("sounds/Weapon_LightningGun.ogg");57 this->setFireSound("sounds/Weapon_LightningGun.ogg"); 58 58 59 59 hudImageString_ = "Orxonox/WSHUD_WM_LightningGun"; -
code/trunk/src/modules/weapons/weaponmodes/MineGun.cc
r11052 r11108 57 57 58 58 this->setMunitionName("MineMunition"); 59 this->set DefaultSound("sounds/mineactivate.ogg");59 this->setFireSound("sounds/mineactivate.ogg"); 60 60 61 61 hudImageString_ = "Orxonox/WSHUD_WM_MineGun"; -
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r11052 r11108 62 62 63 63 this->setMunitionName("RocketMunition"); 64 this->set DefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.4f);64 this->setFireSound("sounds/Rocket_launch.ogg",0.4f); 65 65 // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning) 66 66 -
code/trunk/src/modules/weapons/weaponmodes/SplitGun.cc
r11052 r11108 61 61 62 62 this->setMunitionName("SplitMunition"); 63 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 63 this->setFireSound("sounds/Weapon_SplitGun.ogg", 0.5); 64 this->setReloadSound("sounds/Reload_SplitGun.ogg", 0.8); 64 65 65 66 hudImageString_ = "Orxonox/WSHUD_WM_SplitGun";
Note: See TracChangeset
for help on using the changeset viewer.