void ParticleTrailGenerator::TrailParticleSystemListener::particleStolen(const ParticleEventUnrecPtr e)
{
    if(_mTrailGenerator->_mTrails[e->getParticleIndex()].size() > 0)
    {
        _mTrailGenerator->_mKilledParticleTrails[e->getParticleIndex()] =_mTrailGenerator->_mTrails[e->getParticleIndex()];
    }
    _mTrailGenerator->_mTrails[e->getParticleIndex()] = _mTrailGenerator->_mTrails[_mTrailGenerator->_mTrails.size()-1];
    _mTrailGenerator->_mTrails.erase(_mTrailGenerator->_mTrails.size()-1);
    _mTrailGenerator->internalKill(e);
}
    void
ParticleTrailGenerator::TrailParticleSystemListener::particleGenerated(const ParticleEventUnrecPtr e)
{
    ParticleTrailGenerator::TrailSection newSection;
    newSection.pos = e->getParticlePosition();
    newSection.time = e->getTimeStamp();
    newSection.ID = _mTrailGenerator->getNextTSID();
    ParticleTrailGenerator::ParticleTrail trail;
    trail.push_back(newSection);
    _mTrailGenerator->_mTrails[e->getParticleIndex()] = trail;
    _mTrailGenerator->internalGenerated(e);
    _mTrailGenerator->internalTrailSectGenerated(newSection, e->getParticleVelocity());
}
Пример #3
0
    virtual void particleKilled(const ParticleEventUnrecPtr e)
    {
        dynamic_pointer_cast<SphereDistribution3D>(FireballPositionDistribution)->setCenter(e->getParticlePosition());

        dynamic_pointer_cast<SphereDistribution3D>(ShrapnelPositionDistribution)->setCenter(e->getParticlePosition());

        dynamic_pointer_cast<DiscDistribution3D>(SmokePositionDistribution)->setCenter(e->getParticlePosition());


        // if()
        {

            //Attach the Generator to the Shrapnel Particle System
            ShrapnelParticleSystem->pushToGenerators(ShrapnelBurstGenerator);

            //Attach the Affector to the Smoke Particle System
            SmokeParticleSystem->pushToGenerators(SmokeGenerator);
            SmokeParticleSystem->pushToAffectors(SmokeAgeFadeParticleAffector);
            SmokeParticleSystem->pushToAffectors(SmokeAgeSizeParticleAffector);

            //Attach the Affector to the fireball Particle System
            FireballParticleSystem->pushToGenerators(FireballGenerator);
            FireballParticleSystem->pushToAffectors(FireballAgeSizeParticleAffector);

        }
        std::cout << "Rocket Died at: " << e->getParticlePosition() << std::endl;
    }