Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10695 in orxonox.OLD for trunk/src/world_entities/effects


Ignore:
Timestamp:
Jun 14, 2007, 4:46:18 PM (18 years ago)
Author:
snellen
Message:

changes on soundengine and mover by fabian landau

Location:
trunk/src/world_entities/effects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/effects/explosion.cc

    r10665 r10695  
    2525#include "particles/sprite_particles.h"
    2626
     27#include "sound/resource_sound_buffer.h"
     28#include "sound_engine.h"
     29
     30
    2731ObjectListDefinition(Explosion);
    2832CREATE_FAST_FACTORY_STATIC(Explosion);
     
    3842                        //Explode !
    3943                            ->addMethod("explode", Executor3<Explosion, lua_State*, float, float, float>(&Explosion::explode))
     44                            ->addMethod("setExplosionSound", Executor1<Explosion, lua_State*, const std::string&>(&Explosion::setExplosionSound))
    4045                       );
    4146
     
    5560  this->lifeCycle = 0.0f;
    5661  this->lifeTime = .5f;
    57 
     62 
     63  this->explosionSound.setSourceNode(this);
     64 
    5865}
    5966
     
    6572{
    6673  delete this->emitter;
    67 
     74  if (this->explosionSound.isPlaying())
     75    this->explosionSound.stop();
    6876  /* this is normaly done by World.cc by deleting the ParticleEngine */
    6977  if (Explosion::explosionParticles != NULL && Explosion::objectList().size() <= 1)
     
    8896  explosion->emitter->setSize(Vector(x,y,z));
    8997  explosion->activate();
     98 
     99 
    90100}
    91101
     
    113123  this->toList(OM_DEAD_TICK);
    114124  this->lifeCycle = 0.0;
     125 
     126  this->explosionSound.play(this->explosionSoundBuffer, OrxSound::SoundEngine::getInstance()->getEffectsVolume(), 0.01, true);
    115127}
    116128
  • trunk/src/world_entities/effects/explosion.h

    r10665 r10695  
    88
    99#include "world_entity.h"
     10#include "sound_source.h"
     11#include "sound_buffer.h"
     12#include "sound/resource_sound_buffer.h"
    1013
    1114class SpriteParticles;
     
    1922    static void explode (PNode* position, const Vector& size);
    2023    void explode (float x, float y, float z); /// Explode at the current position with size (x,y,z)
     24    void setExplosionSound(const std::string& newExplosionSound){  this->explosionSoundBuffer = OrxSound::ResourceSoundBuffer(newExplosionSound);  }
    2125   
    2226    Explosion ();
     
    3640    static SpriteParticles*    explosionParticles;
    3741    BoxEmitter*                emitter;
     42   
     43    OrxSound::SoundSource      explosionSound;
     44    OrxSound::SoundBuffer      explosionSoundBuffer;
    3845};
    3946
Note: See TracChangeset for help on using the changeset viewer.