Changeset 2272 for code/branches/weapon2/src/orxonox/objects
- Timestamp:
- Nov 26, 2008, 2:17:18 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox/objects/weaponSystem
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h
r2232 r2272 51 51 52 52 virtual void fire(); 53 void attachNeededMunition(std::string munitionType); 54 virtual void setParentWeaponSystem(); 55 Munition * getAttachedMunition(); 56 57 //reloading 53 58 void bulletTimer(); 54 59 void magazineTimer(); 55 60 void bulletReloaded(); 56 61 void magazineReloaded(); 57 void attachNeededMunition(std::string munitionType);58 59 //get and set functions60 virtual void setParentWeaponSystem();61 Munition * getAttachedMunition();62 62 void setBulletLoadingTime(float loadingTime); 63 63 float getBulletLoadingTime(); -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc
r2203 r2272 85 85 */ 86 86 87 87 88 //n is the n'th weaponSet, starting with zero 88 89 //SpaceShip.cc only needs to have the keybinding to a specific Set-number n -
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: -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2232 r2272 46 46 //this->setLoadingTime(0.5); 47 47 48 // Hack --> willbe loaded by XML48 //how could it be loaded by XML 49 49 this->attachNeededMunition("LaserGunMunition"); 50 50 } … … 58 58 if ( this->getBulletReadyToShoot() && this->getMagazineReadyToShoot() ) 59 59 { 60 61 62 63 60 //take munition 64 61 this->getAttachedMunition()->removeBullets(1,this); … … 67 64 68 65 //create projectile 69 BillboardProjectile* projectile = new ParticleProjectile(this,this); 66 BillboardProjectile* projectile = new ParticleProjectile(this); 67 projectile->setOrientation(projectile->getOrientation()); 68 projectile->setPosition(projectile->getWorldPosition()); 69 projectile->setVelocity(WorldEntity::FRONT * this->speed_); 70 70 71 //projectile->setColour(this->getProjectileColour()); 71 72 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
r2203 r2272 53 53 54 54 private: 55 float speed_; 55 56 56 57
Note: See TracChangeset
for help on using the changeset viewer.