Changeset 6315 for code/branches/presentation2/src/modules/weapons
- Timestamp:
- Dec 10, 2009, 8:56:48 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
r6313 r6315 55 55 56 56 this->localAngularVelocity_ = 0; 57 this->bDestroy_ = false; 58 this->lifetime_ = 100; 57 59 58 60 if (GameMode::isMaster()) … … 60 62 this->setCollisionType(WorldEntity::Kinematic); 61 63 this->setVelocity(0,0,-100); 62 this->lifetime_ = 100;63 this->bDestroy_ = false;64 64 65 65 Model* model = new Model(this); … … 82 82 83 83 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this))); 84 85 this->defSndWpnEngine_ = new WorldSound(this); 86 this->defSndWpnEngine_->setLooping(true); 87 this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg"); 88 this->attach(defSndWpnEngine_); 89 90 this->defSndWpnLaunch_ = new WorldSound(this); 91 this->defSndWpnLaunch_->setLooping(false); 92 this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg"); 93 this->attach(defSndWpnLaunch_); 94 } 95 else 96 { 97 this->defSndWpnEngine_ = 0; 98 this->defSndWpnLaunch_ = 0; 84 99 } 85 100 … … 88 103 camPosition->setAllowMouseLook(true); 89 104 this->addCameraPosition(camPosition); 90 91 if( GameMode::isMaster() )92 {93 this->defSndWpnEngine_ = new WorldSound(this);94 this->defSndWpnEngine_->setLooping(true);95 this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");96 this->attach(defSndWpnEngine_);97 98 this->defSndWpnLaunch_ = new WorldSound(this);99 this->defSndWpnLaunch_->setLooping(false);100 this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");101 this->attach(defSndWpnLaunch_);102 }103 else104 {105 this->defSndWpnEngine_ = 0;106 this->defSndWpnLaunch_ = 0;107 }108 105 } 109 106 … … 120 117 this->player_->stopTemporaryControl(); 121 118 } 122 if(this->defSndWpnEngine_->isPlaying()) 123 { 124 this->defSndWpnEngine_->stop(); 125 } 126 if(this->defSndWpnLaunch_->isPlaying()) 127 { 128 this->defSndWpnLaunch_->stop(); 129 } 130 delete this->defSndWpnEngine_; 131 delete this->defSndWpnLaunch_; 119 if ( this->defSndWpnEngine_ ) 120 { 121 if ( this->defSndWpnEngine_->isPlaying() ) 122 this->defSndWpnEngine_->stop(); 123 delete this->defSndWpnEngine_; 124 } 125 if ( this->defSndWpnLaunch_ ) 126 { 127 if ( this->defSndWpnLaunch_->isPlaying()) 128 this->defSndWpnLaunch_->stop(); 129 delete this->defSndWpnLaunch_; 130 } 132 131 } 133 132 } … … 150 149 this->owner_->getPlayer()->startTemporaryControl(this); 151 150 152 this->defSndWpnEngine_->play(); 153 this->defSndWpnLaunch_->play(); 151 if( GameMode::isMaster() ) 152 { 153 this->defSndWpnEngine_->play(); 154 this->defSndWpnLaunch_->play(); 155 } 154 156 } 155 157
Note: See TracChangeset
for help on using the changeset viewer.