Changeset 5929 for code/trunk/src/modules/weapons/projectiles
- Timestamp:
- Oct 12, 2009, 8:20:07 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core5 (added) merged: 5768-5769,5772,5775-5780,5783-5785,5791-5792,5795-5807,5809-5814,5816-5832,5836-5839,5842-5853,5855-5899,5904-5922,5924-5928
- Property svn:mergeinfo changed
-
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
r5781 r5929 42 42 this->textureIndex_ = 1; 43 43 this->maxTextureIndex_ = 8; 44 this->textureTimer_.setTimer(0.01f, true, this, createExecutor(createFunctor(&LightningGunProjectile::changeTexture)));44 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); 45 45 46 46 registerVariables(); -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
r5781 r5929 50 50 unsigned int textureIndex_; 51 51 unsigned int maxTextureIndex_; 52 Timer <LightningGunProjectile>textureTimer_;52 Timer textureTimer_; 53 53 std::string materialBase_; 54 54 private: -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
r5781 r5929 59 59 { 60 60 this->detachOgreObject(this->particles_->getParticleSystem()); 61 delete this->particles_;61 this->particles_->destroy(); 62 62 } 63 63 } -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r5781 r5929 61 61 this->attachCollisionShape(shape); 62 62 63 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));63 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Projectile::destroyObject, this))); 64 64 } 65 65 } … … 84 84 85 85 if (this->bDestroy_) 86 delete this;86 this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick() 87 87 } 88 88 … … 90 90 { 91 91 if (GameMode::isMaster()) 92 delete this;92 this->destroy(); 93 93 } 94 94 … … 133 133 } 134 134 135 void Projectile:: destroyedPawn(Pawn* pawn)135 void Projectile::setOwner(Pawn* owner) 136 136 { 137 if (this->owner_ == pawn) 138 this->owner_ = 0; 137 this->owner_ = owner; 139 138 } 140 139 } -
code/trunk/src/modules/weapons/projectiles/Projectile.h
r5781 r5929 33 33 34 34 #include "tools/Timer.h" 35 #include "interfaces/PawnListener.h"36 35 #include "worldentities/MovableEntity.h" 37 36 38 37 namespace orxonox 39 38 { 40 class _WeaponsExport Projectile : public MovableEntity , public PawnListener39 class _WeaponsExport Projectile : public MovableEntity 41 40 { 42 41 public: … … 49 48 virtual void tick(float dt); 50 49 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 51 virtual void destroyedPawn(Pawn* pawn);52 50 53 51 inline void setDamage(float damage) … … 56 54 { return this->damage_; } 57 55 58 inline void setOwner(Pawn* owner) 59 { this->owner_ = owner; } 56 void setOwner(Pawn* owner); 60 57 inline Pawn* getOwner() const 61 58 { return this->owner_; } 62 59 63 60 private: 64 Pawn*owner_;61 WeakPtr<Pawn> owner_; 65 62 float lifetime_; 66 63 float damage_; 67 64 bool bDestroy_; 68 Timer <Projectile>destroyTimer_;65 Timer destroyTimer_; 69 66 }; 70 67 }
Note: See TracChangeset
for help on using the changeset viewer.