Last change
on this file since 668 was
664,
checked in by landauf, 17 years ago
|
- bigger explosions
- changed camera orientation
|
File size:
1.4 KB
|
Rev | Line | |
---|
[646] | 1 | #include "Explosion.h" |
---|
| 2 | #include "../Orxonox.h" |
---|
| 3 | |
---|
| 4 | namespace orxonox |
---|
| 5 | { |
---|
| 6 | CreateFactory(Explosion); |
---|
| 7 | |
---|
| 8 | Explosion::Explosion(WorldEntity* owner) |
---|
| 9 | { |
---|
| 10 | RegisterObject(Explosion); |
---|
| 11 | |
---|
| 12 | this->particle_ = 0; |
---|
| 13 | this->lifetime_ = 0.4; |
---|
| 14 | |
---|
| 15 | if (owner) |
---|
| 16 | { |
---|
| 17 | this->destroyTimer_.setTimer(this->lifetime_, false, this, &Explosion::destroyObject); |
---|
| 18 | |
---|
| 19 | Vector3 position = owner->getNode()->getWorldPosition(); |
---|
| 20 | |
---|
| 21 | this->particle_ = new particle::ParticleInterface(Orxonox::getSingleton()->getSceneManager(), "explosion" + this->getName(), "Orxonox/treibwerk"); |
---|
| 22 | this->particle_->getParticleSystem()->setParameter("local_space", "true"); |
---|
| 23 | this->particle_->newEmitter(); |
---|
[664] | 24 | this->particle_->setPositionOfEmitter(0, Vector3::ZERO); |
---|
| 25 | this->particle_->setPositionOfEmitter(1, Vector3::ZERO); |
---|
| 26 | this->particle_->setColour(ColourValue(1.0, 0.8, 0.2)); |
---|
[646] | 27 | |
---|
[664] | 28 | this->setPosition(position); |
---|
| 29 | this->scale(2); |
---|
| 30 | |
---|
[646] | 31 | this->particle_->addToSceneNode(this->getNode()); |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | Explosion::~Explosion() |
---|
| 36 | { |
---|
| 37 | if (this->particle_) |
---|
| 38 | { |
---|
| 39 | this->particle_->detachFromSceneNode(); |
---|
| 40 | delete this->particle_; |
---|
| 41 | } |
---|
| 42 | }; |
---|
| 43 | |
---|
| 44 | void Explosion::destroyObject() |
---|
| 45 | { |
---|
| 46 | delete this; |
---|
| 47 | } |
---|
| 48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.