Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 23, 2015, 3:44:31 PM (8 years ago)
Author:
holzerj
Message:

Added Mine, ice particle, rocketfire, psygun

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.cc

    r10629 r10836  
    3434#include "IceGunProjectile.h"
    3535
     36#include <OgreSceneManager.h>
     37#include <OgreSceneNode.h>
     38
    3639#include "core/CoreIncludes.h"
    3740#include "graphics/Model.h"
     41#include "graphics/ParticleSpawner.h"
     42#include "Scene.h"
     43#include "core/command/Executor.h"
     44#include "tools/ParticleInterface.h"
    3845
    3946namespace orxonox
     
    5562        this->attach(model);
    5663        model->setPosition(Vector3(0,0,0));
     64
     65        // Add effect.
     66        emitter_ = new ParticleEmitter(this->getContext());
     67        this->attach(emitter_);
     68        emitter_->setOrientation(this->getOrientation());
     69        emitter_->setSource("Orxonox/ice");       
     70    }
     71
     72    IceGunProjectile::~IceGunProjectile()
     73    {
     74        if (this->isInitialized())
     75        {
     76            const Vector3& pos = emitter_->getWorldPosition();
     77            const Quaternion& rot = emitter_->getWorldOrientation();
     78            this->detach(emitter_);
     79            emitter_->setPosition(pos);
     80            emitter_->setOrientation(rot);
     81            emitter_->getParticleInterface()->setEnabled(false);
     82            this->getScene()->getRootSceneNode()->addChild(const_cast<Ogre::SceneNode*>(emitter_->getNode()));
     83
     84            const ExecutorPtr& executor = createExecutor(createFunctor(&ParticleEmitter::destroy, emitter_));
     85            new Timer(15, false, executor, true);
     86        }
    5787    }
    5888
Note: See TracChangeset for help on using the changeset viewer.