- Timestamp:
- May 30, 2010, 3:44:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc
r7018 r7019 64 64 65 65 if (GameMode::isMaster()) 66 {66 { 67 67 this->setCollisionType(WorldEntity::Kinematic); 68 68 this->fuel_=true; … … 100 100 101 101 SUPER(SimpleRocket, tick, dt); 102 if (this->getVelocity().squaredLength() >130000) this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :) 103 102 if ( GameMode::isMaster() ) 103 { 104 if (this->getVelocity().squaredLength() >130000) 105 this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :) 106 104 107 105 108 this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_); … … 108 111 109 112 110 if (this->fuel_) { 113 if (this->fuel_) 114 { 111 115 if (this->destroyTimer_.getRemainingTime()< this->lifetime_-this->maxLife_ ) 112 116 this->fuel_=false; 113 } else this->disableFire(); 117 } 118 else 119 this->disableFire(); 114 120 115 121 if( this->bDestroy_ ) 116 122 this->destroy(); 123 } 117 124 118 125 } 119 126 120 void SimpleRocket::disableFire(){ 121 this->setAcceleration(0,0,0); 122 this->fire_->detachFromParent(); 123 127 void SimpleRocket::disableFire() 128 { 129 this->setAcceleration(0,0,0); 130 this->fire_->destroy(); 131 this->fire_ = 0; 132 // this->fire_->detachFromParent(); 124 133 } 125 134 … … 132 141 if (this->isInitialized()) 133 142 { 134 this->getController()->destroy(); 135 COUT(4)<< "simplerocket destroyed\n"; 143 if( GameMode::isMaster() ) 144 { 145 this->getController()->destroy(); 146 COUT(4)<< "simplerocket destroyed\n"; 147 } 136 148 } 137 149 } … … 204 216 } 205 217 } 206 207 208 void SimpleRocket::fired(unsigned int firemode)209 {210 if (this->owner_)211 {212 {213 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());214 effect->setPosition(this->getPosition());215 effect->setOrientation(this->getOrientation());216 effect->setDestroyAfterLife(true);217 effect->setSource("Orxonox/explosion4");218 effect->setLifetime(2.0f);219 }220 221 {222 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());223 effect->setPosition(this->getPosition());224 effect->setOrientation(this->getOrientation());225 effect->setDestroyAfterLife(true);226 effect->setSource("Orxonox/smoke4");227 effect->setLifetime(3.0f);228 }229 this->destroy();230 }231 }232 218 233 219 /**
Note: See TracChangeset
for help on using the changeset viewer.