- Timestamp:
- May 25, 2011, 9:22:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/weapons/projectiles/Rocket.cc
r7848 r8578 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 52 52 Constructor. Registers the object and initializes some default values. 53 53 */ 54 Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator) 54 Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile() 55 55 { 56 56 RegisterObject(Rocket);// - register the Rocket class to the core 57 57 58 58 this->localAngularVelocity_ = 0; 59 this->bDestroy_ = false;60 59 this->lifetime_ = 100; 61 60 … … 146 145 { 147 146 this->owner_ = owner; 148 this->player_ = this-> owner_->getPlayer();149 this-> owner_->getPlayer()->startTemporaryControl(this);147 this->player_ = this->getOwner()->getPlayer(); 148 this->getOwner()->getPlayer()->startTemporaryControl(this); 150 149 151 150 if( GameMode::isMaster() ) … … 175 174 if( GameMode::isMaster() ) 176 175 { 177 if( this-> bDestroy_)176 if( this->getBDestroy() ) 178 177 this->destroy(); 179 178 … … 181 180 } 182 181 182 /* Calls the collidesAgainst function of BasicProjectile 183 */ 183 184 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 184 185 { 185 if (!this->bDestroy_ && GameMode::isMaster()) 186 { 187 if (otherObject == this->owner_) 188 return false; 189 190 this->bDestroy_ = true; 191 192 if (this->owner_) 193 { 194 { 195 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 196 effect->setPosition(this->getPosition()); 197 effect->setOrientation(this->getOrientation()); 198 effect->setDestroyAfterLife(true); 199 effect->setSource("Orxonox/explosion4"); 200 effect->setLifetime(2.0f); 201 } 202 203 { 204 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 205 effect->setPosition(this->getPosition()); 206 effect->setOrientation(this->getOrientation()); 207 effect->setDestroyAfterLife(true); 208 effect->setSource("Orxonox/smoke4"); 209 effect->setLifetime(3.0f); 210 } 211 } 212 213 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 214 if (victim) 215 victim->hit(this->owner_, contactPoint, this->damage_); 216 // this->destroy(); 217 } 218 return false; 186 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 219 187 } 220 188 … … 233 201 void Rocket::fired(unsigned int firemode) 234 202 { 235 // if (this->owner_) 236 // { 237 this->destroy(); 238 // } 203 this->destroy(); 239 204 } 240 205 … … 242 207 { 243 208 ParticleSpawner *effect1, *effect2; 244 if( this-> owner_)245 { 246 effect1 = new ParticleSpawner(this-> owner_->getCreator());247 effect2 = new ParticleSpawner(this-> owner_->getCreator());209 if( this->getOwner() ) 210 { 211 effect1 = new ParticleSpawner(this->getOwner()->getCreator()); 212 effect2 = new ParticleSpawner(this->getOwner()->getCreator()); 248 213 } 249 214 else
Note: See TracChangeset
for help on using the changeset viewer.