- 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/Rocket.cc
r8578 r8579 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * simonmie25 * ... 26 26 * 27 27 */ … … 52 52 Constructor. Registers the object and initializes some default values. 53 53 */ 54 Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator) , BasicProjectile()54 Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator) 55 55 { 56 56 RegisterObject(Rocket);// - register the Rocket class to the core 57 57 58 58 this->localAngularVelocity_ = 0; 59 this->bDestroy_ = false; 59 60 this->lifetime_ = 100; 60 61 … … 145 146 { 146 147 this->owner_ = owner; 147 this->player_ = this-> getOwner()->getPlayer();148 this-> getOwner()->getPlayer()->startTemporaryControl(this);148 this->player_ = this->owner_->getPlayer(); 149 this->owner_->getPlayer()->startTemporaryControl(this); 149 150 150 151 if( GameMode::isMaster() ) … … 174 175 if( GameMode::isMaster() ) 175 176 { 176 if( this-> getBDestroy())177 if( this->bDestroy_ ) 177 178 this->destroy(); 178 179 … … 180 181 } 181 182 182 /* Calls the collidesAgainst function of BasicProjectile183 */184 183 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 185 184 { 186 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 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; 187 219 } 188 220 … … 201 233 void Rocket::fired(unsigned int firemode) 202 234 { 203 this->destroy(); 235 // if (this->owner_) 236 // { 237 this->destroy(); 238 // } 204 239 } 205 240 … … 207 242 { 208 243 ParticleSpawner *effect1, *effect2; 209 if( this-> getOwner())210 { 211 effect1 = new ParticleSpawner(this-> getOwner()->getCreator());212 effect2 = new ParticleSpawner(this-> getOwner()->getCreator());244 if( this->owner_ ) 245 { 246 effect1 = new ParticleSpawner(this->owner_->getCreator()); 247 effect2 = new ParticleSpawner(this->owner_->getCreator()); 213 248 } 214 249 else
Note: See TracChangeset
for help on using the changeset viewer.