Changeset 7065 in orxonox.OLD for trunk/src/world_entities/power_ups/power_up.cc
- Timestamp:
- Feb 7, 2006, 1:13:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/power_ups/power_up.cc
r6973 r7065 21 21 #include "primitive_model.h" 22 22 23 #include "resource_manager.h" 23 24 #include "load_param.h" 24 25 … … 42 43 this->sphereMaterial->setDiffuse(r, g, b); 43 44 this->toList(OM_COMMON); 45 46 this->soundSource.setSourceNode(this); 47 this->soundBuffer = NULL; 44 48 } 45 49 … … 47 51 { 48 52 delete this->sphereMaterial; 53 if (this->soundBuffer != NULL) 54 ResourceManager::getInstance()->unload(this->soundBuffer); 49 55 } 50 56 … … 53 59 { 54 60 WorldEntity::loadParams(root); 61 55 62 LoadParam(root, "respawnType", this, PowerUp, setRespawnType); 63 56 64 LoadParam(root, "respawnTime", this, PowerUp, setRespawnTime); 65 66 LoadParam(root, "pickup-sound", this, PowerUp, loadPickupSound); 57 67 } 58 68 69 70 void PowerUp::loadPickupSound(const char* pickupSound) 71 { 72 if (this->soundBuffer != NULL) 73 ResourceManager::getInstance()->unload(this->soundBuffer); 74 75 else if (pickupSound != NULL) 76 { 77 this->soundBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV); 78 if (this->soundBuffer != NULL) 79 { 80 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound, this->getName()); 81 } 82 else 83 { 84 PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound, this->getName()); 85 } 86 } 87 else 88 this->soundBuffer = NULL; 89 } 59 90 60 91 void PowerUp::collidesWith (WorldEntity* entity, const Vector& location) … … 64 95 if(dynamic_cast<Extendable*>(entity)->pickup(this)) 65 96 { 97 if(soundBuffer != NULL) 98 this->soundSource.play(this->soundBuffer); 99 66 100 switch(respawnType) { 67 101 case RESPAWN_NONE:
Note: See TracChangeset
for help on using the changeset viewer.