- Timestamp:
- May 25, 2011, 9:28:29 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.cc
r8578 r8579 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * simonmie25 * ... 26 26 * 27 27 */ … … 48 48 CreateFactory(SimpleRocket); 49 49 50 SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator) , BasicProjectile()50 SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator) 51 51 { 52 52 RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core 53 53 54 54 this->localAngularVelocity_ = 0; 55 this->bDestroy_ = false; 55 56 this->lifetime_ = 120; 56 57 57 58 this->setMass(15); 58 //COUT(4) << "simplerocket constructed\n";59 COUT(4) << "simplerocket constructed\n"; 59 60 60 61 if (GameMode::isMaster()) … … 114 115 this->disableFire(); 115 116 116 if( this-> getBDestroy())117 if( this->bDestroy_ ) 117 118 this->destroy(); 118 119 } … … 158 159 { 159 160 this->owner_ = owner; 160 this->player_ = this-> getOwner()->getPlayer();161 } 162 163 164 /* Calls the collidesAgainst function of BasicProjectile 165 */ 161 this->player_ = this->owner_->getPlayer(); 162 } 163 164 165 166 166 167 bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 167 168 { 168 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 169 if (!this->bDestroy_ && GameMode::isMaster()) 170 { 171 if (otherObject == this->owner_) 172 return false; 173 174 this->bDestroy_ = true; 175 176 if (this->owner_) 177 { 178 { 179 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 180 effect->setPosition(this->getPosition()); 181 effect->setOrientation(this->getOrientation()); 182 effect->setDestroyAfterLife(true); 183 effect->setSource("Orxonox/explosion4"); 184 effect->setLifetime(2.0f); 185 } 186 187 { 188 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 189 effect->setPosition(this->getPosition()); 190 effect->setOrientation(this->getOrientation()); 191 effect->setDestroyAfterLife(true); 192 effect->setSource("Orxonox/smoke4"); 193 effect->setLifetime(3.0f); 194 } 195 } 196 197 float dmg = this->damage_; 198 // if (this->owner_) 199 // dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false); 200 201 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 202 if (victim) 203 victim->hit(this->owner_, contactPoint, dmg); 204 } 205 return false; 169 206 } 170 207
Note: See TracChangeset
for help on using the changeset viewer.