- Timestamp:
- Nov 26, 2008, 2:17:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
r2232 r2272 40 40 #include "objects/worldentities/Model.h" 41 41 #include "objects/worldentities/ParticleSpawner.h" 42 #include " Settings.h"42 #include "core/Core.h" 43 43 44 44 namespace orxonox 45 45 { 46 float Projectile::speed_s = 5000; 47 48 Projectile::Projectile(BaseObject* creator, Weapon* owner) : MovableEntity(creator), owner_(owner) 46 Projectile::Projectile(BaseObject* creator) : MovableEntity(creator) 49 47 { 50 48 RegisterObject(Projectile); … … 57 55 this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL); 58 56 57 /* 59 58 if (this->owner_) 60 59 { … … 63 62 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 64 63 } 64 */ 65 65 66 if(! orxonox::Settings::isClient()) //only if not on client66 if(!Core::isClient()) //only if not on client 67 67 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject))); 68 68 } … … 76 76 SetConfigValue(damage_, 15.0).description("The damage caused by the projectile"); 77 77 SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive"); 78 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);79 78 } 80 79 81 void Projectile::speedChanged()82 {83 Projectile::speed_s = this->speed_;84 if (this->owner_)85 this->setVelocity(this->owner_->getInitialDir() * this->speed_);86 }87 80 88 81 void Projectile::tick(float dt) … … 103 96 { 104 97 // hit 105 ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0); 98 ParticleSpawner* explosion = new ParticleSpawner(this); 99 explosion->setSource(this->explosionTemplateName_); 100 explosion->setLOD(LODParticle::low); 101 explosion->configure(2.0); 106 102 explosion->setPosition(this->getPosition()); 107 103 explosion->create(); 108 ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0); 104 ParticleSpawner* smoke = new ParticleSpawner(this); 105 smoke->setSource(this->smokeTemplateName_); 106 smoke->setLOD(LODParticle::normal); 107 smoke->configure(2.0, 0.0); 109 108 smoke->setPosition(this->getPosition()); 110 109 // smoke->getParticleInterface()->setSpeedFactor(3.0);
Note: See TracChangeset
for help on using the changeset viewer.