Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2414 for code/branches


Ignore:
Timestamp:
Dec 12, 2008, 4:39:13 AM (16 years ago)
Author:
landauf
Message:

added spawn- and destroy-effects to Pawn

Location:
code/branches/objecthierarchy2/src/orxonox
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/GlobalShader.cc

    r2350 r2414  
    4444
    4545        if (!this->getScene())
    46             ThrowException(AbortLoading, "Can't create Camera, no scene given.");
     46            ThrowException(AbortLoading, "Can't create GlobalShader, no scene given.");
    4747        if (!this->getScene()->getSceneManager())
    48             ThrowException(AbortLoading, "Can't create Camera, no scene manager given.");
     48            ThrowException(AbortLoading, "Can't create GlobalShader, no scene manager given.");
    4949
    5050        this->shader_.setSceneManager(this->getScene()->getSceneManager());
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc

    r2406 r2414  
    6161        {
    6262            if (!this->getScene())
    63                 ThrowException(AbortLoading, "Can't create Camera, no scene given.");
     63                ThrowException(AbortLoading, "Can't create Backlight, no scene given.");
    6464            if (!this->getScene()->getSceneManager())
    65                 ThrowException(AbortLoading, "Can't create Camera, no scene manager given.");
     65                ThrowException(AbortLoading, "Can't create Backlight, no scene manager given.");
    6666            if (!this->getScene()->getRootSceneNode())
    67                 ThrowException(AbortLoading, "Can't create Camera, no root scene node given.");
     67                ThrowException(AbortLoading, "Can't create Backlight, no root scene node given.");
    6868
    6969            this->ribbonTrail_ = this->getScene()->getSceneManager()->createRibbonTrail(this->getNode()->getName());
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/CMakeLists.txt

    r2254 r2414  
    88  Billboard.cc
    99  BlinkingBillboard.cc
     10  ExplosionChunk.cc
    1011  FadingBillboard.cc
    1112  Light.cc
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ParticleEmitter.cc

    r2171 r2414  
    5151
    5252        if (!this->getScene() || !this->getScene()->getSceneManager())
    53             ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
     53            ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
    5454
    5555        this->particles_ = 0;
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2369 r2414  
    3737#include "objects/gametypes/Gametype.h"
    3838#include "objects/weaponSystem/WeaponSystem.h"
     39#include "objects/worldentities/ParticleSpawner.h"
     40#include "objects/worldentities/ExplosionChunk.h"
    3941
    4042namespace orxonox
     
    5658        this->lastHitOriginator_ = 0;
    5759        this->weaponSystem_ = 0;
     60
     61        this->spawnparticleduration_ = 3.0f;
    5862
    5963        /*
     
    8791        XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
    8892        XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
     93        XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
     94        XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
     95        XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
    8996    }
    9097
     
    133140    }
    134141
    135     void Pawn::spawn()
     142    void Pawn::spawneffect()
    136143    {
    137144        // play spawn effect
     145        if (this->spawnparticlesource_ != "")
     146        {
     147            ParticleSpawner* effect = new ParticleSpawner(this);
     148            effect->setPosition(this->getPosition());
     149            effect->setOrientation(this->getOrientation());
     150            effect->setDestroyAfterLife(true);
     151            effect->setSource(this->spawnparticlesource_);
     152            effect->setLifetime(this->spawnparticleduration_);
     153        }
    138154    }
    139155
     
    151167            this->getPlayer()->stopControl(this);
    152168
     169        this->deatheffect();
     170    }
     171
     172    void Pawn::deatheffect()
     173    {
    153174        // play death effect
     175        {
     176            ParticleSpawner* effect = new ParticleSpawner(this);
     177            effect->setPosition(this->getPosition());
     178            effect->setOrientation(this->getOrientation());
     179            effect->setDestroyAfterLife(true);
     180            effect->setSource("Orxonox/explosion2");
     181            effect->setLifetime(4.0f);
     182        }
     183        {
     184            ParticleSpawner* effect = new ParticleSpawner(this);
     185            effect->setPosition(this->getPosition());
     186            effect->setOrientation(this->getOrientation());
     187            effect->setDestroyAfterLife(true);
     188            effect->setSource("Orxonox/smoke6");
     189            effect->setLifetime(4.0f);
     190        }
     191        {
     192            ParticleSpawner* effect = new ParticleSpawner(this);
     193            effect->setPosition(this->getPosition());
     194            effect->setOrientation(this->getOrientation());
     195            effect->setDestroyAfterLife(true);
     196            effect->setSource("Orxonox/sparks");
     197            effect->setLifetime(4.0f);
     198        }
     199        for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
     200        {
     201            ExplosionChunk* chunk = new ExplosionChunk(this);
     202            chunk->setPosition(this->getPosition());
     203
     204        }
    154205    }
    155206
     
    163214    {
    164215        this->setHealth(this->initialHealth_);
    165         this->spawn();
     216        this->spawneffect();
    166217    }
    167218
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2369 r2414  
    8282                { return (WorldEntity*)this; }
    8383
     84            inline void setSpawnParticleSource(const std::string& source)
     85                { this->spawnparticlesource_ = source; }
     86            inline const std::string& getSpawnParticleSource() const
     87                { return this->spawnparticlesource_; }
     88
     89            inline void setSpawnParticleDuration(float duration)
     90                { this->spawnparticleduration_ = duration; }
     91            inline float getSpawnParticleDuration() const
     92                { return this->spawnparticleduration_; }
     93
     94            inline void setExplosionChunks(unsigned int chunks)
     95                { this->numexplosionchunks_ = chunks; }
     96            inline unsigned int getExplosionChunks() const
     97                { return this->numexplosionchunks_; }
     98
    8499        protected:
    85             virtual void spawn();
    86100            virtual void death();
     101            virtual void deatheffect();
     102            virtual void spawneffect();
    87103
    88104            bool bAlive_;
     
    95111
    96112            WeaponSystem* weaponSystem_;
     113
     114            std::string spawnparticlesource_;
     115            float spawnparticleduration_;
     116            unsigned int numexplosionchunks_;
    97117    };
    98118
  • code/branches/objecthierarchy2/src/orxonox/tools/ParticleInterface.cc

    r2406 r2414  
    6363        this->bVisible_ = true;
    6464        this->bAllowedByLOD_ = true;
     65        this->speedFactor_ = 1.0f;
    6566
    6667        if (Core::showsGraphics())
Note: See TracChangeset for help on using the changeset viewer.