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:
4 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");
  • code/branches/presentationHS13/src/orxonox/worldentities/BigExplosion.h

    r9667 r9900  
    2222 *   Author:
    2323 *      Benjamin de Capitani
    24  *   Co-authors:
     24 *   Co-authors:§
    2525 *      ...
    2626 *
     
    3333
    3434#include "tools/Timer.h"
    35 #include "StaticEntity.h"
     35#include "MobileEntity.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport BigExplosion : public StaticEntity
     39    class _OrxonoxExport BigExplosion : public MobileEntity
    4040    {
    4141        public:
    4242            BigExplosion(Context* context);
     43            BigExplosion(Context* context, Vector3 initVelocity);
    4344            virtual ~BigExplosion();
    4445
     
    6061            bool                  bStop_;
    6162
    62             StaticEntity*         explosion_;
     63            MobileEntity*         explosion_;
    6364
    6465            MovableEntity*        debrisEntity1_;
  • code/branches/presentationHS13/src/orxonox/worldentities/pawns/Pawn.cc

    r9667 r9900  
    365365        this->setDestroyWhenPlayerLeft(false);
    366366
    367         BigExplosion* chunk = new BigExplosion(this->getContext());
     367        orxout() << "big explosion: " << this->getVelocity() << endl;
     368        BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity());
    368369        chunk->setPosition(this->getPosition());
     370        // chunk->setVelocity(this->getVelocity());
    369371
    370372    }
     
    376378            effect->setPosition(this->getPosition());
    377379            effect->setOrientation(this->getOrientation());
     380            effect->setVelocity(this->getVelocity());
    378381            effect->setDestroyAfterLife(true);
    379382            effect->setSource("Orxonox/explosion2b");
     
    384387            effect->setPosition(this->getPosition());
    385388            effect->setOrientation(this->getOrientation());
     389            effect->setVelocity(this->getVelocity());
    386390            effect->setDestroyAfterLife(true);
    387391            effect->setSource("Orxonox/smoke6");
     
    392396            effect->setPosition(this->getPosition());
    393397            effect->setOrientation(this->getOrientation());
     398            effect->setVelocity(this->getVelocity());
    394399            effect->setDestroyAfterLife(true);
    395400            effect->setSource("Orxonox/sparks");
Note: See TracChangeset for help on using the changeset viewer.