Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 17, 2008, 3:33:03 PM (16 years ago)
Author:
landauf
Message:
  • added a backlight to all SpaceShips, leaving a trail behind (configurable)
  • changed some lines in SpaceShipAI, AI seems to be more fair now…
  • fixed a bug in Math.cc algorithms to calculate radar positions and AI movement (division by zero and acos of 1.000001)
  • added destroy() and destroydelay to ParticleSpawner, so the smoketrail of a destroyed enemy stays visible for some seconds
  • added 2 lines to Orxonox.cc to make the length of the backlight-trail independend of the gamespeed

########################
# !!! MEDIA UPDATE !!! #
########################

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/ParticleSpawner.cc

    r1602 r1608  
    3333#include "core/Executor.h"
    3434#include "tools/ParticleInterface.h"
     35#include "GraphicsEngine.h"
    3536
    3637namespace orxonox
     
    4445    }
    4546
    46     ParticleSpawner::ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float delay, const Vector3& direction)
     47    ParticleSpawner::ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float startdelay, float destroydelay, const Vector3& direction)
    4748    {
    4849        RegisterObject(ParticleSpawner);
    49         this->setParticle(templateName, detaillevel, lifetime, delay, direction);
     50        this->setParticle(templateName, detaillevel, lifetime, startdelay, destroydelay, direction);
    5051    }
    5152
    52     void ParticleSpawner::setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float delay, const Vector3& direction)
     53    void ParticleSpawner::setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float startdelay, float destroydelay, const Vector3& direction)
    5354    {
    5455        ExecutorMember<ParticleSpawner>* executor = createExecutor(createFunctor(&ParticleSpawner::createParticleSpawner));
     56        this->destroydelay_ = destroydelay;
    5557        executor->setDefaultValues(lifetime);
    56         this->timer_.setTimer(delay, false, this, executor);
     58        this->timer_.setTimer(startdelay, false, this, executor);
    5759        this->particle_ = new ParticleInterface(templateName, detaillevel);
    5860        this->particle_->addToSceneNode(this->getNode());
     
    7274        }
    7375    };
     76
     77    void ParticleSpawner::destroy()
     78    {
     79        this->setPosition(this->getNode()->getParent()->getPosition());
     80        this->getNode()->getParent()->removeChild(this->getNode());
     81        GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->addChild(this->getNode());
     82        if (this->particle_)
     83            this->particle_->setEnabled(false);
     84        if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
     85            this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
     86    }
    7487
    7588    void ParticleSpawner::createParticleSpawner(float lifetime)
Note: See TracChangeset for help on using the changeset viewer.