Changeset 8855 for code/trunk/src/modules/weapons/projectiles/Projectile.cc
- Timestamp:
- Aug 22, 2011, 3:05:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file Projectile.h 31 @brief Implementation of the Projectile class. 32 */ 33 29 34 #include "Projectile.h" 30 35 36 #include "core/ConfigValueIncludes.h" 31 37 #include "core/CoreIncludes.h" 32 #include "core/ConfigValueIncludes.h"33 38 #include "core/GameMode.h" 34 39 #include "core/command/Executor.h" 40 35 41 #include "objects/collisionshapes/SphereCollisionShape.h" 36 42 #include "worldentities/pawns/Pawn.h" 37 #include "graphics/ParticleSpawner.h"38 43 39 44 namespace orxonox … … 46 51 47 52 this->setConfigValues(); 48 this->owner_ = 0;49 53 50 54 // Get notification about collisions 51 55 if (GameMode::isMaster()) 52 56 { 53 this->setMass(1.0 );57 this->setMass(1.0f); 54 58 this->enableCollisionCallback(); 55 59 this->setCollisionResponse(false); … … 57 61 58 62 SphereCollisionShape* shape = new SphereCollisionShape(this); 59 shape->setRadius(20 );63 shape->setRadius(20.0f); 60 64 this->attachCollisionShape(shape); 61 65 62 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(& Projectile::destroyObject, this)));66 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); 63 67 } 64 68 } … … 70 74 void Projectile::setConfigValues() 71 75 { 72 SetConfigValue(lifetime_, 4.0 ).description("The time in seconds a projectile stays alive");76 SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive"); 73 77 } 74 78 … … 81 85 return; 82 86 83 if (this->getBDestroy()) 84 this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick() 87 this->destroyCheck(); 85 88 } 86 89 87 void Projectile::destroyObject()90 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 88 91 { 89 if (GameMode::isMaster()) 90 this->destroy(); 92 return this->processCollision(otherObject, contactPoint); 91 93 } 92 94 93 /* Calls the collidesAgainst function of BasicProjectile94 */95 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)96 {97 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);98 }99 100 void Projectile::setOwner(Pawn* owner)101 {102 this->owner_ = owner;103 }104 95 }
Note: See TracChangeset
for help on using the changeset viewer.