Changeset 7084 in orxonox.OLD for trunk/src/world_entities/projectiles/projectile.cc
- Timestamp:
- Feb 7, 2006, 4:51:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.