Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2009, 3:52:28 PM (14 years ago)
Author:
youngk
Message:

Implemented Firing sounds in Weapons HsW01, LightningGun and RocketFire. Engine and Explosion sounds for the Rocket are not yet implemented.
From now on, when creating a new sound for a weapon, just insert "this→setDefaultSound(PATH_TO_FILE)" into the constructor of the weapon.

Sound Files for HsW01 and LightningGun will be available in a couple of minutes

Location:
code/branches/presentation2/src/modules/weapons/weaponmodes
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/modules/weapons/weaponmodes/HsW01.cc

    r6227 r6245  
    5252        RegisterObject(HsW01);
    5353
    54         this->reloadTime_ = 0.5;
     54        this->reloadTime_ = 0.25;
    5555        this->damage_ = 15;
    5656        this->speed_ = 2500;
     
    6161        this->delayTimer_.stopTimer();
    6262
    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");
    6664    }
    6765
    6866    HsW01::~HsW01()
    6967    {
    70         if(this->isInitialized())
    71         {
    72             delete this->defSndWpnFire_;
    73         }
    7468    }
    7569
     
    106100    void HsW01::fire()
    107101    {
    108         this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->attach(this->defSndWpnFire_);
    109         this->defSndWpnFire_->play();
    110 
    111102        this->delayTimer_.startTimer();
    112 
    113         //this->defSndWpnFire_->stop();
    114103    }
    115104
     
    142131        HsW01::muendungsfeuer();
    143132    }
    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     }
    154133}
  • code/branches/presentation2/src/modules/weapons/weaponmodes/HsW01.h

    r6227 r6245  
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4747
    48             void setDefaultSound(const std::string& soundPath);
    49             const std::string& getDefaultSound();
    50 
    5148        private:
    5249            void setMaterial(const std::string& material);
     
    6158            float delay_;
    6259            Timer delayTimer_;
    63 
    64             WorldSound* defSndWpnFire_;
    6560    };
    6661}
  • code/branches/presentation2/src/modules/weapons/weaponmodes/LightningGun.cc

    r6154 r6245  
    3636#include "worldentities/pawns/Pawn.h"
    3737
     38#include "sound/WorldSound.h"
     39
    3840namespace orxonox
    3941{
     
    4951
    5052        this->setMunitionName("LaserMunition");
     53        this->setDefaultSound("sounds/Weapon_LightningGun.ogg");
    5154    }
    5255
     
    5659
    5760    void LightningGun::fire()
    58     {
     61    {       
    5962        LightningGunProjectile* projectile = new LightningGunProjectile(this);
    6063        projectile->setMaterial("Flares/LightningBall_");
  • code/branches/presentation2/src/modules/weapons/weaponmodes/LightningGun.h

    r5781 r6245  
    4242
    4343            virtual void fire();
     44
    4445       private:
    4546            float speed_;
  • code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.cc

    r6153 r6245  
    3838#include "worldentities/pawns/Pawn.h"
    3939
     40#include "sound/WorldSound.h"
     41
    4042namespace orxonox
    4143{
     
    5254
    5355        this->setMunitionName("RocketMunition");
     56        this->setDefaultSound("sounds/Rocket_Launch.ogg");
     57    }
     58
     59    RocketFire::~RocketFire()
     60    {
    5461    }
    5562
  • code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.h

    r6107 r6245  
    3939        public:
    4040            RocketFire(BaseObject* creator);
    41             virtual ~RocketFire() {}
     41            virtual ~RocketFire();
    4242
    4343            virtual void fire();
Note: See TracChangeset for help on using the changeset viewer.