Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2015, 4:03:59 PM (8 years ago)
Author:
maxima
Message:

Merged presentation and exlposionChunks branches. Works fine. Added explosion parts to hovership.

Location:
code/branches/presentationHS15
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS15

  • code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.cc

    r10961 r10962  
    4141#include "graphics/ParticleSpawner.h"
    4242#include "worldentities/ExplosionChunk.h"
    43 #include "worldentities/BigExplosion.h"
     43#include "worldentities/ExplosionPart.h"
    4444#include "weaponsystem/WeaponSystem.h"
    4545#include "weaponsystem/WeaponSlot.h"
     
    8484        this->aimPosition_ = Vector3::ZERO;
    8585
     86        //this->explosionPartList_ = NULL;
     87
    8688        if (GameMode::isMaster())
    8789        {
     
    136138        XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
    137139        XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
    138         XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
     140        XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(0);
    139141
    140142        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
     
    145147        XMLPortParam(Pawn, "shieldrechargerate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0);
    146148        XMLPortParam(Pawn, "shieldrechargewaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f);
     149        XMLPortObject(Pawn, ExplosionPart, "explosion", addExplosionPart, getExplosionPart, xmlelement, mode);
    147150
    148151        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
     
    164167    void Pawn::tick(float dt)
    165168    {
     169        //BigExplosion* chunk = new BigExplosion(this->getContext());
    166170        SUPER(Pawn, tick, dt);
    167171
     
    368372            if (GameMode::isMaster())
    369373            {
    370                 this->deatheffect();
    371374                this->goWithStyle();
    372375            }
     
    375378    void Pawn::goWithStyle()
    376379    {
     380
    377381        this->bAlive_ = false;
    378382        this->setDestroyWhenPlayerLeft(false);
    379383
    380         BigExplosion* chunk = new BigExplosion(this->getContext());
    381         chunk->setPosition(this->getPosition());
    382         chunk->setVelocity(this->getVelocity());
     384        while(!explosionPartList_.empty())
     385        {
     386            explosionPartList_.back()->setPosition(this->getPosition());
     387            explosionPartList_.back()->setVelocity(this->getVelocity());
     388            explosionPartList_.back()->setOrientation(this->getOrientation());
     389            explosionPartList_.back()->Explode();
     390            explosionPartList_.pop_back();
     391        }
     392
     393        for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
     394        {
     395            ExplosionChunk* chunk = new ExplosionChunk(this->getContext());
     396            chunk->setPosition(this->getPosition());
     397        }
    383398
    384399        this->explosionSound_->setPosition(this->getPosition());
    385400        this->explosionSound_->play();
    386     }
    387     void Pawn::deatheffect()
    388     {
    389         // play death effect
    390         /*{
    391             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    392             effect->setPosition(this->getPosition());
    393             effect->setOrientation(this->getOrientation());
    394             effect->setDestroyAfterLife(true);
    395             effect->setSource("Orxonox/explosion2b");
    396             effect->setLifetime(4.0f);
    397         }
    398         {
    399             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    400             effect->setPosition(this->getPosition());
    401             effect->setOrientation(this->getOrientation());
    402             effect->setDestroyAfterLife(true);
    403             effect->setSource("Orxonox/smoke6");
    404             effect->setLifetime(4.0f);
    405         }
    406         {
    407             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    408             effect->setPosition(this->getPosition());
    409             effect->setOrientation(this->getOrientation());
    410             effect->setDestroyAfterLife(true);
    411             effect->setSource("Orxonox/sparks");
    412             effect->setLifetime(4.0f);
    413         }*/
    414        
    415        
    416         {
    417             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    418             effect->setPosition(this->getPosition());
    419             effect->setOrientation(this->getOrientation());
    420             effect->setDestroyAfterLife(true);
    421             effect->setSource("orxonox/explosion_flash2");
    422             effect->setLifetime(5.0f);
    423         }
    424         {
    425             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    426             effect->setPosition(this->getPosition());
    427             effect->setOrientation(this->getOrientation());
    428             effect->setDestroyAfterLife(true);
    429             effect->setSource("orxonox/explosion_flame2");
    430             effect->setLifetime(5.0f);
    431         }
    432         {
    433             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    434             effect->setPosition(this->getPosition());
    435             effect->setOrientation(this->getOrientation());
    436             effect->setDestroyAfterLife(true);
    437             effect->setSource("orxonox/explosion_shockwave2");
    438             effect->scale(20);
    439             effect->setLifetime(5.0f);
    440         }{
    441             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    442             effect->setPosition(this->getPosition());
    443             effect->setOrientation(this->getOrientation());
    444             effect->setDestroyAfterLife(true);
    445             effect->setSource("orxonox/explosion_sparks2");
    446             effect->setLifetime(5.0f);
    447         }
    448         {
    449             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    450             effect->setPosition(this->getPosition());
    451             effect->setOrientation(this->getOrientation());
    452             effect->setDestroyAfterLife(true);
    453             effect->setSource("orxonox/explosion_streak2");
    454             effect->setLifetime(5.0f);
    455         }
    456         {
    457             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    458             effect->setPosition(this->getPosition());
    459             effect->setOrientation(this->getOrientation());
    460             effect->setDestroyAfterLife(true);
    461             effect->setSource("orxonox/explosion_afterglow");
    462             effect->scale(20);
    463             effect->setLifetime(5.0f);
    464         }
    465        
    466        
    467         for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
    468         {
    469             ExplosionChunk* chunk = new ExplosionChunk(this->getContext());
    470             chunk->setPosition(this->getPosition());
    471         }
    472401    }
    473402
     
    476405        Check whether the Pawn has a @ref Orxonox::WeaponSystem and fire it with the specified firemode if it has one.
    477406    */
     407
    478408    void Pawn::fired(unsigned int firemode)
    479409    {
     
    488418            this->spawneffect();
    489419    }
     420
     421
     422    void Pawn::addExplosionPart(ExplosionPart* ePart)
     423    {this->explosionPartList_.push_back(ePart);}
     424
     425
     426    ExplosionPart * Pawn::getExplosionPart()
     427    {return this->explosionPartList_.back();}
     428
     429
    490430
    491431    /* WeaponSystem:
Note: See TracChangeset for help on using the changeset viewer.