Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2013, 1:33:09 PM (11 years ago)
Author:
smerkli
Message:

Merged the invaders branch of Florian

Location:
code/branches/presentationHS13
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS13

  • code/branches/presentationHS13/src/orxonox/worldentities/BigExplosion.cc

    r9667 r9900  
    4343    RegisterClass(BigExplosion);
    4444
    45     BigExplosion::BigExplosion(Context* context) : StaticEntity(context)
     45    BigExplosion::BigExplosion(Context* context) : MobileEntity(context)
    4646    {
    4747        RegisterObject(BigExplosion);
     48
     49        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     50            ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
     51
     52        this->bStop_ = false;
     53        this->LOD_ = LODParticle::Normal;
     54
     55        if ( GameMode::showsGraphics() )
     56        {
     57            try
     58            {
     59                this->init();
     60            }
     61            catch (const std::exception& ex)
     62            {
     63                orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
     64                this->initZero();
     65            }
     66        }
     67        else
     68        {
     69            this->initZero();
     70        }
     71
     72        if (GameMode::isMaster())
     73        {
     74            this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
     75        }
     76
     77        this->registerVariables();
     78    }
     79
     80    BigExplosion::BigExplosion(Context* context, Vector3 initVelocity) : MobileEntity(context)
     81    {
     82        RegisterObject(BigExplosion);
     83        this->setVelocity(initVelocity);
    4884
    4985        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     
    100136        this->debris4_->setSyncMode(0);
    101137
    102         this->explosion_ = new StaticEntity(this->getContext());
     138        this->explosion_ = new MobileEntity(this->getContext());
    103139        this->explosion_->setSyncMode(0);
    104140
     
    148184        this->debrisEntity4_->attach(debris4_);
    149185
     186        // ///////////////////////
     187        // TODO: particleSpawner is a static entity. It should probably be dynamic, for better explosions.
     188        //
    150189        ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     190        orxout() << "vel " << this->getVelocity() << endl;
     191        // effect->setVelocity(this->getVelocity());
    151192        effect->setDestroyAfterLife(true);
    152193        effect->setSource("Orxonox/explosion2b");
     
    155196
    156197        ParticleSpawner* effect2 = new ParticleSpawner(this->getContext());
     198        // effect2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 200));
    157199        effect2->setDestroyAfterLife(true);
    158200        effect2->setSource("Orxonox/smoke6");
Note: See TracChangeset for help on using the changeset viewer.