Пример #1
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;
    }
    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());
}