Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6247


Ignore:
Timestamp:
Dec 4, 2009, 6:05:39 PM (15 years ago)
Author:
youngk
Message:

Implemented exhaust sound for rocket. Explosion sounds of any sort (either Rocket or Ship) do not work yet.
BUG Firing sound won't attach to HsW01 specifically. Other weapons work.

Location:
code/branches/presentation2/src/modules/weapons/projectiles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc

    r6228 r6247  
    3939#include "worldentities/CameraPosition.h"
    4040
     41#include "sound/WorldSound.h"
     42
    4143namespace orxonox
    4244{
     
    8688        camPosition->setAllowMouseLook(true);
    8789        this->addCameraPosition(camPosition);
    88     }
    89 
    90     /**
    91     @brief
    92         Destructor. Destroys controller, if present.
     90
     91        this->defSndWpnEngine_ = new WorldSound(this);
     92        this->defSndWpnEngine_->setLooping(true);
     93        this->defSndWpnEngine_->setSource("sounds/Rocket_Engine.ogg");
     94        this->attach(defSndWpnEngine_);
     95    }
     96
     97    /**
     98    @brief
     99        Destructor. Destroys controller, if present and kills sounds, if playing.
    93100    */
    94101    Rocket::~Rocket()
     
    97104        {
    98105            if (GameMode::isMaster() && this->player_)
     106            {
    99107                this->player_->stopTemporaryControl();
     108            }
     109            if(this->defSndWpnEngine_->isPlaying())
     110            {
     111                this->defSndWpnEngine_->stop();
     112            }
     113            delete this->defSndWpnEngine_;
    100114        }
    101115    }
     
    117131        this->player_ = this->owner_->getPlayer();
    118132        this->owner_->getPlayer()->startTemporaryControl(this);
     133
     134        this->defSndWpnEngine_->play();
    119135    }
    120136
     
    185201    {
    186202        if (GameMode::isMaster())
     203        {
     204            if(this->defSndWpnEngine_->isPlaying())
     205            {
     206                this->defSndWpnEngine_->stop();
     207            }
    187208            this->destroy();
     209        }
    188210    }
    189211   
  • code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h

    r6167 r6247  
    122122            Timer destroyTimer_;
    123123            float lifetime_;
     124
     125            WorldSound* defSndWpnEngine_;
     126            WorldSound* defSndWpnExplosion_;
    124127    };
    125128
Note: See TracChangeset for help on using the changeset viewer.