- Timestamp:
- Dec 17, 2008, 2:10:11 AM (16 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
- Property svn:mergeinfo changed
/code/branches/weapon2 (added) merged: 2108,2145,2186,2203,2232,2272-2273,2288,2308,2319,2327,2331,2337,2347,2354,2366-2368,2379,2391,2393,2398,2410
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc
r2099 r2493 30 30 #include "BillboardProjectile.h" 31 31 32 #include <OgreBillboard .h>32 #include <OgreBillboardSet.h> 33 33 34 34 #include "core/CoreIncludes.h" 35 #include "objects/Scene.h" 35 36 36 37 namespace orxonox … … 38 39 CreateFactory(BillboardProjectile); 39 40 40 BillboardProjectile::BillboardProjectile(BaseObject* creator , Weapon* owner) : Projectile(creator, owner)41 BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator) 41 42 { 42 43 RegisterObject(BillboardProjectile); 43 44 44 this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1); 45 this->attachObject(this->billboard_.getBillboardSet()); 46 this->scale(0.5); 45 assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity 46 47 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1); 48 this->attachOgreObject(this->billboard_.getBillboardSet()); 49 this->scale(0.2); 47 50 } 48 51 49 52 BillboardProjectile::~BillboardProjectile() 50 53 { 51 if (this->isInitialized() && this->owner_)52 this->detachObject(this->billboard_.getBillboardSet());54 //if (this->isInitialized() && this->owner_) 55 //this->detachObject(this->billboard_.getBillboardSet()); 53 56 } 54 57 55 58 void BillboardProjectile::setColour(const ColourValue& colour) 56 59 { 57 this->billboard_. getBillboardSet()->getBillboard(0)->setColour(colour);60 this->billboard_.setColour(colour); 58 61 } 59 62 -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h
r2099 r2493 41 41 { 42 42 public: 43 BillboardProjectile(BaseObject* creator , Weapon* owner = 0);43 BillboardProjectile(BaseObject* creator); 44 44 virtual ~BillboardProjectile(); 45 45 -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
r2099 r2493 30 30 #include "ParticleProjectile.h" 31 31 32 #include "SpaceShip.h" 32 #include <OgreParticleSystem.h> 33 #include <OgreParticleEmitter.h> 34 35 #include "../../worldentities/pawns/SpaceShip.h" 33 36 #include "core/CoreIncludes.h" 34 37 #include "core/ConfigValueIncludes.h" 38 #include "objects/Scene.h" 35 39 36 40 namespace orxonox … … 38 42 CreateFactory(ParticleProjectile); 39 43 40 ParticleProjectile::ParticleProjectile(BaseObject* creator , Weapon* owner) : BillboardProjectile(creator, owner)44 ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator) 41 45 { 42 46 RegisterObject(ParticleProjectile); 43 47 44 this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal); 45 this->particles_->addToSceneNode(this->getNode()); 46 this->particles_->setKeepParticlesInLocalSpace(true); 48 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal); 49 this->attachOgreObject(this->particles_->getParticleSystem()); 50 this->particles_->setKeepParticlesInLocalSpace(0); 51 52 this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT); 53 /* 47 54 if (this->owner_) 48 55 { … … 52 59 // this->particles_ = 0; 53 60 // } 61 */ 54 62 55 63 this->setConfigValues(); … … 59 67 { 60 68 if (this->isInitialized() && this->particles_) 69 { 70 this->detachOgreObject(this->particles_->getParticleSystem()); 61 71 delete this->particles_; 72 } 62 73 } 63 74 64 75 void ParticleProjectile::setConfigValues() 65 76 { 66 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);77 //SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged); 67 78 } 68 79 … … 72 83 this->particles_->setEnabled(this->isVisible()); 73 84 } 74 75 bool ParticleProjectile::create(){76 if(!Projectile::create())77 return false;78 this->particles_->getAllEmitters()->setDirection(-this->getOrientation()*Vector3(1,0,0));79 return true;80 }81 85 } -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h
r2099 r2493 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(); 46 46 void setConfigValues(); 47 48 virtual bool create();49 47 50 48 private: -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
r2466 r2493 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); … … 54 52 this->smokeTemplateName_ = "Orxonox/smoke4"; 55 53 56 this->setStatic(false);57 this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);54 //this->setStatic(false); 55 // this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL); 58 56 59 57 // Get notification about collisions 60 58 this->enableCollisionCallback(); 61 59 60 /* 62 61 if (this->owner_) 63 62 { … … 66 65 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 67 66 } 67 */ 68 68 69 if(! orxonox::Settings::isClient()) //only if not on client69 if(!Core::isClient()) //only if not on client 70 70 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject))); 71 71 } … … 79 79 SetConfigValue(damage_, 15.0).description("The damage caused by the projectile"); 80 80 SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive"); 81 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);82 81 } 83 82 84 void Projectile::speedChanged()85 {86 Projectile::speed_s = this->speed_;87 if (this->owner_)88 this->setVelocity(this->owner_->getInitialDir() * this->speed_);89 }90 83 91 84 void Projectile::tick(float dt) … … 95 88 if (!this->isActive()) 96 89 return; 97 90 /* 98 91 float radius; 99 92 for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it) … … 106 99 { 107 100 // hit 108 ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0); 101 ParticleSpawner* explosion = new ParticleSpawner(this); 102 explosion->setSource(this->explosionTemplateName_); 103 explosion->setLOD(LODParticle::low); 104 explosion->configure(2.0); 109 105 explosion->setPosition(this->getPosition()); 110 106 explosion->create(); 111 ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0); 107 ParticleSpawner* smoke = new ParticleSpawner(this); 108 smoke->setSource(this->smokeTemplateName_); 109 smoke->setLOD(LODParticle::normal); 110 smoke->configure(2.0, 0.0); 112 111 smoke->setPosition(this->getPosition()); 113 112 // smoke->getParticleInterface()->setSpeedFactor(3.0); … … 118 117 } 119 118 } 119 */ 120 120 } 121 121 … … 124 124 delete this; 125 125 } 126 127 bool Projectile::create(){128 return WorldEntity::create();129 }130 126 } -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.h
r2099 r2493 42 42 virtual ~Projectile(); 43 43 void setConfigValues(); 44 void speedChanged();45 44 void destroyObject(); 46 45 virtual void tick(float dt); 47 46 48 virtual bool create();49 50 static float getSpeed()51 { return Projectile::speed_s; }52 53 47 protected: 54 Projectile(BaseObject* creator, Weapon* owner = 0); 55 SpaceShip* owner_; 48 Projectile(BaseObject* creator); 56 49 57 50 private: … … 59 52 std::string smokeTemplateName_; 60 53 protected: 61 static float speed_s;62 54 float speed_; 63 55 private:
Note: See TracChangeset
for help on using the changeset viewer.