Changeset 10963 for code/branches/presentationHS15/src/modules/weapons/projectiles/IceGunProjectile.cc
- Timestamp:
- Dec 9, 2015, 4:56:39 PM (9 years ago)
- Location:
- code/branches/presentationHS15
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationHS15
- Property svn:mergeinfo changed
/code/branches/particleEffectsHS15 (added) merged: 10644,10671,10706,10836,10889,10897,10901,10908,10911,10944,10948
- Property svn:mergeinfo changed
-
code/branches/presentationHS15/src/modules/weapons/projectiles/IceGunProjectile.cc
r10629 r10963 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 emitter_ = new ParticleEmitter(this->getContext()); 69 this->attach(emitter_); 70 emitter_->setOrientation(this->getOrientation()); 71 emitter_->setSource("Orxonox/ice"); 72 emitter_->setDeleteWithParent(false); 73 } 74 75 IceGunProjectile::~IceGunProjectile() 76 { 77 if (this->isInitialized()) 78 { 79 const Vector3& pos = emitter_->getWorldPosition(); 80 const Quaternion& rot = emitter_->getWorldOrientation(); 81 this->detach(emitter_); 82 emitter_->setPosition(pos); 83 emitter_->setOrientation(rot); 84 emitter_->getParticleInterface()->setEnabled(false); 85 this->getScene()->getRootSceneNode()->addChild(const_cast<Ogre::SceneNode*>(emitter_->getNode())); 86 87 const ExecutorPtr& executor = createExecutor(createFunctor(&ParticleEmitter::destroy, emitter_)); 88 new Timer(particleDestructionDelay_, false, executor, true); 89 } 57 90 } 58 91
Note: See TracChangeset
for help on using the changeset viewer.