Changeset 10629 for code/trunk/src/modules/weapons/projectiles
- Timestamp:
- Oct 10, 2015, 4:34:26 PM (9 years ago)
- Location:
- code/trunk/src/modules/weapons/projectiles
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc
r9667 r10629 88 88 /** 89 89 @brief 90 Get the material of the BillboardProjectile. 91 @return 92 The material name. 93 */ 94 const std::string& BillboardProjectile::getMaterial() 95 { 96 return this->billboard_.getMaterial(); 97 } 98 99 /** 100 @brief 90 101 Is called when the visibility of the BillboardProjectile has changed. 91 102 */ -
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
r9667 r10629 60 60 virtual void setColour(const ColourValue& colour); 61 61 virtual void setMaterial(const std::string& material); 62 virtual const std::string& getMaterial(); 62 63 virtual void changedVisibility(); 63 64 -
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
r10622 r10629 5 5 Projectile.cc 6 6 LightningGunProjectile.cc 7 SplitGunProjectile.cc 8 IceGunProjectile.cc 7 9 Rocket.cc 8 10 RocketOld.cc -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r10287 r10629 39 39 #include "core/command/Executor.h" 40 40 41 #include "objects/collisionshapes/SphereCollisionShape.h"42 41 #include "worldentities/pawns/Pawn.h" 43 42 … … 60 59 this->setCollisionType(Dynamic); 61 60 62 SphereCollisionShape* shape = new SphereCollisionShape(this->getContext()); 63 shape->setRadius(20.0f); 64 this->attachCollisionShape(shape); 61 // Create a sphere collision shape and attach it to the projectile. 62 collisionShape_ = new SphereCollisionShape(this->getContext()); 63 setCollisionShapeRadius(20.0f); 64 this->attachCollisionShape(collisionShape_); 65 65 66 66 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); … … 76 76 SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive"); 77 77 } 78 79 78 80 79 void Projectile::tick(float dt) … … 93 92 } 94 93 94 void Projectile::setCollisionShapeRadius(float radius) 95 { 96 if (collisionShape_ != NULL && radius > 0) 97 { 98 collisionShape_->setRadius(radius); 99 } 100 } 95 101 } -
code/trunk/src/modules/weapons/projectiles/Projectile.h
r10216 r10629 39 39 #include "tools/Timer.h" 40 40 #include "worldentities/MovableEntity.h" 41 #include "objects/collisionshapes/SphereCollisionShape.h" 41 42 42 43 #include "BasicProjectile.h" … … 66 67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 67 68 69 protected: 70 virtual void setCollisionShapeRadius(float radius); 71 68 72 private: 69 73 float lifetime_; //!< The time the projectile exists. 70 74 Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out. 75 WeakPtr<SphereCollisionShape> collisionShape_; // The collision shape of the projectile. 71 76 }; 72 77 }
Note: See TracChangeset
for help on using the changeset viewer.