Changeset 11052 for code/trunk/src/modules/weapons/projectiles
- Timestamp:
- Jan 9, 2016, 6:26:20 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 12 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
r10293 r11052 68 68 @brief 69 69 The function called when a projectile hits another thing. 70 Calls the hit-function, starts the reloadcountdown, displays visual hit effects defined in Pawn.70 Calls the hit-function, starts the shield recharge countdown, displays visual hit effects defined in Pawn. 71 71 Needs to be called in the collidesAgainst() function by every Class directly inheriting from BasicProjectile. 72 72 @param otherObject … … 97 97 { 98 98 victim->hit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage()); 99 victim->start ReloadCountdown();99 victim->startShieldRechargeCountdown(); 100 100 } 101 101 -
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
r10629 r11052 12 12 GravityBomb.cc 13 13 GravityBombField.cc 14 MineProjectile.cc 14 15 ) -
code/trunk/src/modules/weapons/projectiles/GravityBombField.cc
r10622 r11052 164 164 if (lifetime_ <= -4) 165 165 { 166 orxout(debug_output) << "Timeout. Destroying field." << endl;167 166 this->destroy(); 168 167 } -
code/trunk/src/modules/weapons/projectiles/IceGunProjectile.cc
- Property svn:eol-style set to native
r10629 r11052 34 34 #include "IceGunProjectile.h" 35 35 36 #include <OgreSceneManager.h> 37 #include <OgreSceneNode.h> 38 36 39 #include "core/CoreIncludes.h" 37 40 #include "graphics/Model.h" 41 #include "graphics/ParticleSpawner.h" 42 #include "Scene.h" 43 #include "core/command/Executor.h" 44 #include "tools/ParticleInterface.h" 38 45 39 46 namespace orxonox 40 47 { 41 48 RegisterClass(IceGunProjectile); 49 50 const float IceGunProjectile::particleDestructionDelay_ = 15.0f; 42 51 43 52 IceGunProjectile::IceGunProjectile(Context* context) : Projectile(context) … … 55 64 this->attach(model); 56 65 model->setPosition(Vector3(0,0,0)); 66 67 // Add effect. 68 spawner_ = new ParticleSpawner(this->getContext()); 69 this->attach(spawner_); 70 spawner_->setOrientation(this->getOrientation()); 71 spawner_->setSource("Orxonox/ice"); 72 spawner_->setDeleteWithParent(false); 73 spawner_->setDestroydelay(particleDestructionDelay_); 74 } 75 76 IceGunProjectile::~IceGunProjectile() 77 { 78 if (this->isInitialized()) 79 { 80 const Vector3& pos = spawner_->getWorldPosition(); 81 const Quaternion& rot = spawner_->getWorldOrientation(); 82 this->detach(spawner_); 83 spawner_->setPosition(pos); 84 spawner_->setOrientation(rot); 85 this->getScene()->getRootSceneNode()->addChild(const_cast<Ogre::SceneNode*>(spawner_->getNode())); 86 this->spawner_->stop(true); 87 } 57 88 } 58 89 -
code/trunk/src/modules/weapons/projectiles/IceGunProjectile.h
- Property svn:eol-style set to native
r10629 r11052 56 56 public: 57 57 IceGunProjectile(Context* context); 58 virtual ~IceGunProjectile() {}58 virtual ~IceGunProjectile(); 59 59 60 60 virtual void setFreezeTime(float freezeTime); … … 63 63 protected: 64 64 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 65 private: 65 static const float particleDestructionDelay_; 66 private: 67 ParticleSpawner* spawner_; 66 68 float freezeTime_; //The duration of the freezing effect on a target 67 69 float freezeFactor_; //The strength of the freezing effect -
code/trunk/src/modules/weapons/projectiles/Projectile.h
r10629 r11052 69 69 protected: 70 70 virtual void setCollisionShapeRadius(float radius); 71 float lifetime_; //!< The time the projectile exists. 71 72 72 73 private: 73 float lifetime_; //!< The time the projectile exists.74 74 Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out. 75 WeakPtr<SphereCollisionShape> collisionShape_; // The collision shape of the projectile. 75 WeakPtr<SphereCollisionShape> collisionShape_; // The collision shape of the projectile. 76 76 }; 77 77 } -
code/trunk/src/modules/weapons/projectiles/Rocket.cc
r10622 r11052 66 66 67 67 this->localAngularVelocity_ = 0; 68 this->lifetime_ = 100.0f;68 this->lifetime_ = 20.0f; 69 69 70 70 if (GameMode::isMaster()) … … 76 76 Model* model = new Model(this->getContext()); 77 77 model->setMeshSource("rocket.mesh"); 78 model->scale( 0.7f);78 model->scale(1.0f); 79 79 this->attach(model); 80 80 … … 100 100 this->attachCollisionShape(collisionShape); 101 101 102 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));103 104 102 // Add sound 105 103 this->defSndWpnEngine_ = new WorldSound(this->getContext()); … … 114 112 this->defSndWpnLaunch_->setVolume(1.0f); 115 113 this->attach(defSndWpnLaunch_); 114 115 this->setHudTemplate("rockethud"); 116 116 } 117 117 else … … 320 320 } 321 321 322 float Rocket::getFuel() const 323 { 324 return this->destroyTimer_.getRemainingTime(); 325 } 326 327 void Rocket::setMaxFuel(float fuel) 328 { 329 this->lifetime_ = fuel; 330 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); 331 } 322 332 } -
code/trunk/src/modules/weapons/projectiles/Rocket.h
r10216 r11052 118 118 virtual void fired(unsigned int firemode); 119 119 120 /** 121 @brief Set the maximum lifetime of the rocket. 122 */ 123 virtual void setMaxFuel(float fuel); 124 /** 125 @brief Get the maximum lifetime of the rocket. 126 */ 127 inline float getMaxFuel() const 128 { return lifetime_; } 129 virtual float getFuel() const; 130 120 131 private: 121 132 Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input. -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
r10299 r11052 76 76 Model* model = new Model(this->getContext()); 77 77 model->setMeshSource("rocket.mesh"); 78 model->scale( 0.7f);78 model->scale(1.0f); 79 79 this->attach(model); 80 80 -
code/trunk/src/modules/weapons/projectiles/SplitGunProjectile.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/weapons/projectiles/SplitGunProjectile.h
- Property svn:eol-style set to native
Note: See TracChangeset
for help on using the changeset viewer.