Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2013, 3:43:45 PM (10 years ago)
Author:
smerkli
Message:

Merged sfxThilo branch, things seem to be working fine

Location:
code/branches/presentationHS13
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS13

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

    r9900 r9918  
    4646#include "weaponsystem/WeaponPack.h"
    4747#include "weaponsystem/WeaponSet.h"
     48#include "sound/WorldSound.h"
    4849
    4950#include "controllers/FormationController.h"
     
    100101
    101102        this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
     103
     104        if (GameMode::isMaster())
     105        {
     106            this->explosionSound_ = new WorldSound(this->getContext());
     107            this->explosionSound_->setVolume(1.0f);
     108        }
     109        else
     110        {
     111            this->explosionSound_ = 0;
     112        }
    102113    }
    103114
     
    109120                this->weaponSystem_->destroy();
    110121        }
     122
    111123    }
    112124
     
    135147        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    136148
     149        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
     150
    137151        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
    138152    }
     153
    139154
    140155    void Pawn::registerVariables()
     
    290305    void Pawn::kill()
    291306    {
    292         this->damage(this->health_);
     307        this->damage(this->health_);
    293308        this->death();
    294309    }
     
    314329        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
    315330        {
    316             // Set bAlive_ to false and wait for PawnManager to do the destruction
     331            explosionSound_->play();
     332                // Set bAlive_ to false and wait for PawnManager to do the destruction
    317333            this->bAlive_ = false;
    318334
     
    532548
    533549
     550    void Pawn::setExplosionSound(const std::string &explosionSound)
     551    {
     552        if(explosionSound_ )
     553            explosionSound_->setSource(explosionSound);
     554        else
     555            assert(0); // This should never happen, because soundpointer is only available on master
     556    }
     557
     558    const std::string& Pawn::getExplosionSound()
     559    {
     560        if( explosionSound_ )
     561            return explosionSound_->getSource();
     562        else
     563            assert(0);
     564        return BLANKSTRING;
     565    }
     566
    534567
    535568}
Note: See TracChangeset for help on using the changeset viewer.