Changeset 7163 for code/trunk/src/modules/weapons/projectiles
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
r6417 r7163 5 5 LightningGunProjectile.cc 6 6 Rocket.cc 7 SimpleRocket.cc 7 8 ) -
code/trunk/src/modules/weapons/projectiles/Rocket.cc
r6540 r7163 41 41 #include "controllers/Controller.h" 42 42 #include "sound/WorldSound.h" 43 #include "Scene.h" 43 44 44 45 namespace orxonox … … 87 88 this->defSndWpnEngine_->setLooping(true); 88 89 this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg"); 90 this->defSndWpnEngine_->setVolume(100); 89 91 this->attach(defSndWpnEngine_); 90 92 … … 92 94 this->defSndWpnLaunch_->setLooping(false); 93 95 this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg"); 96 this->defSndWpnLaunch_->setVolume(100); 94 97 this->attach(defSndWpnLaunch_); 95 98 } … … 114 117 if(this->isInitialized()) 115 118 { 116 if (GameMode::isMaster() && this->player_) 117 this->player_->stopTemporaryControl(); 119 if (GameMode::isMaster()) 120 { 121 this->destructionEffect(); 122 123 if (this->getPlayer() && this->getController()) 124 this->player_->stopTemporaryControl(); 125 } 118 126 119 127 if ( this->defSndWpnEngine_ ) … … 138 146 { 139 147 this->owner_ = owner; 140 this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();141 148 this->player_ = this->owner_->getPlayer(); 142 149 this->owner_->getPlayer()->startTemporaryControl(this); … … 164 171 this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() ); 165 172 this->localAngularVelocity_ = 0; 166 173 } 174 175 if( GameMode::isMaster() ) 176 { 167 177 if( this->bDestroy_ ) 168 178 this->destroy(); 179 169 180 } 170 181 } … … 222 233 void Rocket::fired(unsigned int firemode) 223 234 { 224 if (this->owner_) 225 { 226 { 227 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 228 effect->setPosition(this->getPosition()); 229 effect->setOrientation(this->getOrientation()); 230 effect->setDestroyAfterLife(true); 231 effect->setSource("Orxonox/explosion4"); 232 effect->setLifetime(2.0f); 233 } 234 235 { 236 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 237 effect->setPosition(this->getPosition()); 238 effect->setOrientation(this->getOrientation()); 239 effect->setDestroyAfterLife(true); 240 effect->setSource("Orxonox/smoke4"); 241 effect->setLifetime(3.0f); 242 } 235 // if (this->owner_) 236 // { 243 237 this->destroy(); 244 } 238 // } 239 } 240 241 void Rocket::destructionEffect() 242 { 243 ParticleSpawner *effect1, *effect2; 244 if( this->owner_ ) 245 { 246 effect1 = new ParticleSpawner(this->owner_->getCreator()); 247 effect2 = new ParticleSpawner(this->owner_->getCreator()); 248 } 249 else 250 { 251 effect1 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get())); 252 effect2 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get())); 253 } 254 255 effect1->setPosition(this->getPosition()); 256 effect1->setOrientation(this->getOrientation()); 257 effect1->setDestroyAfterLife(true); 258 effect1->setSource("Orxonox/explosion4"); 259 effect1->setLifetime(2.0f); 260 261 effect2->setPosition(this->getPosition()); 262 effect2->setOrientation(this->getOrientation()); 263 effect2->setDestroyAfterLife(true); 264 effect2->setSource("Orxonox/smoke4"); 265 effect2->setLifetime(3.0f); 245 266 } 246 267 -
code/trunk/src/modules/weapons/projectiles/Rocket.h
r6417 r7163 57 57 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 58 58 void destroyObject(); 59 void destructionEffect(); 59 60 60 61 virtual void moveFrontBack(const Vector2& value){} … … 119 120 float damage_; 120 121 bool bDestroy_; 121 ControllableEntity* originalControllableEntity_;122 122 123 123 WeakPtr<PlayerInfo> player_;
Note: See TracChangeset
for help on using the changeset viewer.