- 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/Projectile.cc
r8578 r8579 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * simonmie25 * ... 26 26 * 27 27 */ … … 41 41 CreateFactory(Projectile); 42 42 43 Projectile::Projectile(BaseObject* creator) : MovableEntity(creator) , BasicProjectile()43 Projectile::Projectile(BaseObject* creator) : MovableEntity(creator) 44 44 { 45 45 RegisterObject(Projectile); 46 46 47 47 this->setConfigValues(); 48 this->bDestroy_ = false; 48 49 this->owner_ = 0; 50 this->damage_ = 15; 49 51 50 52 // Get notification about collisions 53 51 54 if (GameMode::isMaster()) 52 55 { … … 81 84 return; 82 85 83 if (this-> getBDestroy())86 if (this->bDestroy_) 84 87 this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick() 85 88 } … … 91 94 } 92 95 93 /* Calls the collidesAgainst function of BasicProjectile94 */95 96 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 96 97 { 97 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 98 if (!this->bDestroy_ && GameMode::isMaster()) 99 { 100 if (otherObject == this->owner_) 101 return false; 102 103 this->bDestroy_ = true; 104 105 if (this->owner_) 106 { 107 { 108 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 109 effect->setPosition(this->getPosition()); 110 effect->setOrientation(this->getOrientation()); 111 effect->setDestroyAfterLife(true); 112 effect->setSource("Orxonox/explosion3"); 113 effect->setLifetime(2.0f); 114 } 115 { 116 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); 117 effect->setPosition(this->getPosition()); 118 effect->setOrientation(this->getOrientation()); 119 effect->setDestroyAfterLife(true); 120 effect->setSource("Orxonox/smoke4"); 121 effect->setLifetime(3.0f); 122 } 123 } 124 125 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 126 if (victim) 127 victim->hit(this->owner_, contactPoint, this->damage_); 128 } 129 return false; 98 130 } 99 131
Note: See TracChangeset
for help on using the changeset viewer.