- Timestamp:
- Nov 26, 2008, 2:17:18 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc
r2232 r2272 38 38 CreateFactory(BillboardProjectile); 39 39 40 BillboardProjectile::BillboardProjectile(BaseObject* creator , Weapon* owner) : Projectile(creator, owner)40 BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator) 41 41 { 42 42 RegisterObject(BillboardProjectile); -
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h
r2232 r2272 41 41 { 42 42 public: 43 BillboardProjectile(BaseObject* creator , Weapon* owner = 0);43 BillboardProjectile(BaseObject* creator); 44 44 virtual ~BillboardProjectile(); 45 45 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
r2232 r2272 38 38 CreateFactory(ParticleProjectile); 39 39 40 ParticleProjectile::ParticleProjectile(BaseObject* creator , Weapon* owner) : BillboardProjectile(creator, owner)40 ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator) 41 41 { 42 42 RegisterObject(ParticleProjectile); … … 45 45 this->particles_->addToSceneNode(this->getNode()); 46 46 this->particles_->setKeepParticlesInLocalSpace(true); 47 48 /* 47 49 if (this->owner_) 48 50 { … … 52 54 // this->particles_ = 0; 53 55 // } 56 */ 54 57 55 58 this->setConfigValues(); … … 64 67 void ParticleProjectile::setConfigValues() 65 68 { 66 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);69 //SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged); 67 70 } 68 71 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h
r2099 r2272 41 41 { 42 42 public: 43 ParticleProjectile(BaseObject* creator , Weapon* owner = 0);43 ParticleProjectile(BaseObject* creator); 44 44 virtual ~ParticleProjectile(); 45 45 virtual void changedVisibility(); -
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); -
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/Projectile.h
r2099 r2272 42 42 virtual ~Projectile(); 43 43 void setConfigValues(); 44 void speedChanged();45 44 void destroyObject(); 46 45 virtual void tick(float dt); … … 48 47 virtual bool create(); 49 48 50 static float getSpeed()51 { return Projectile::speed_s; }52 53 49 protected: 54 Projectile(BaseObject* creator, Weapon* owner = 0); 55 SpaceShip* owner_; 50 Projectile(BaseObject* creator); 56 51 57 52 private: … … 59 54 std::string smokeTemplateName_; 60 55 protected: 61 static float speed_s;62 56 float speed_; 63 57 private:
Note: See TracChangeset
for help on using the changeset viewer.