Changeset 7084 in orxonox.OLD for trunk/src/world_entities/projectiles
- Timestamp:
- Feb 7, 2006, 4:51:27 PM (19 years ago)
- Location:
- trunk/src/world_entities/projectiles
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/projectiles/bomb.cc
r6825 r7084 79 79 this->detonationMaterial = new Material(); 80 80 this->detonationMaterial->setDiffuse(1, 0, 0); 81 82 this->loadExplosionSound("sound/explosions/explosion_7_far.wav"); 81 83 // this->detonationMaterial->setTransparency(.1); 82 84 /** -
trunk/src/world_entities/projectiles/projectile.cc
r6434 r7084 22 22 #include "world_entities/weapons/weapon.h" 23 23 #include "model.h" 24 #include "resource_manager.h" 24 25 25 26 using namespace std; … … 37 38 this->target = NULL; 38 39 this->removeNode(); 40 41 this->explosionBuffer = NULL; 42 this->engineBuffer = NULL; 39 43 } 40 44 … … 45 49 Projectile::~Projectile () 46 50 { 51 if (this->explosionBuffer != NULL) 52 ResourceManager::getInstance()->unload(this->explosionBuffer); 53 if (this->engineBuffer != NULL) 54 ResourceManager::getInstance()->unload(this->engineBuffer); 47 55 /* 48 56 do not delete the test projectModel, since it is pnode … … 50 58 */ 51 59 //delete this->projectileModel; 60 } 61 62 63 void Projectile::loadExplosionSound(const char* explosionSound) 64 { 65 if (this->explosionBuffer != NULL) 66 ResourceManager::getInstance()->unload(this->explosionBuffer); 67 68 else if (explosionSound != NULL) 69 { 70 this->explosionBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV); 71 if (this->explosionBuffer != NULL) 72 { 73 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound, this->getName()); 74 } 75 else 76 { 77 PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound, this->getName()); 78 } 79 } 80 else 81 this->explosionBuffer = NULL; 82 } 83 84 85 void Projectile::loadEngineSound(const char* engineSound) 86 { 87 if (this->engineBuffer != NULL) 88 ResourceManager::getInstance()->unload(this->engineBuffer); 89 90 else if (engineSound != NULL) 91 { 92 this->engineBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV); 93 if (this->engineBuffer != NULL) 94 { 95 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound, this->getName()); 96 } 97 else 98 { 99 PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound, this->getName()); 100 } 101 } 102 else 103 this->engineBuffer = NULL; 52 104 } 53 105 … … 114 166 */ 115 167 void Projectile::destroy () 116 {} 168 { 169 if (this->explosionBuffer != NULL) 170 this->soundSource.play(this->explosionBuffer); 171 } 117 172 -
trunk/src/world_entities/projectiles/projectile.h
r6434 r7084 12 12 #include "world_entity.h" 13 13 14 #include "sound_source.h" 15 #include "sound_buffer.h" 16 14 17 class Projectile : public WorldEntity 15 18 { … … 22 25 void setLifeSpan(float lifeSpan); 23 26 24 27 void loadExplosionSound(const char* explosionSound); 28 void loadEngineSound(const char* engineSound); 25 29 void setMinEnergy(float energyMin); 26 30 /** @returns the minimal charched energy */ … … 58 62 59 63 PNode* target; //!< A target for guided Weapons. 64 65 SoundSource soundSource; 66 private: 67 SoundBuffer* explosionBuffer; 68 SoundBuffer* engineBuffer; 60 69 }; 61 70
Note: See TracChangeset
for help on using the changeset viewer.