 
 /* AUDIO PROFILE BEHAVIOR 
       by Joe Rossi
    
   This is my workaround to the TGB editor not having audio support in the editor.
  
   Add this behavior to an invisible staticSprite, or one off screen.  
   I personally use a sprite with a music note texture ;)
      
   When the level is loaded, it creates a new audioprofile.
   
   This will look in your game/data/audio folder for the sound
 
 */


if (!isObject(AudioProfileBehavior))
{
   %template = new BehaviorTemplate( AudioProfileBehavior );
   
   %template.friendlyName = "Audio Profile";
   %template.behaviorType = "Audio";
   %template.description  = "Creates a new AudioProfile when this object is loaded.";
  
   %template.addBehaviorField( name, "Name for this audio profile", string , "test"   );
   %template.addBehaviorField( filename, "File name for the audio file in your data/audio directory.", string , ""   );
   %template.addBehaviorField( volume, "The default volume", float ,  1.0  );
   %template.addBehaviorField( description, "The Audio Description to use", string , "test"  );
   
} 
 

function AudioProfileBehavior::onBehaviorAdd(%this){  
  if (!isobject( %this.name ) ){ 
    new AudioProfile(  %this.name  ){
      volume   =  %this.volume ;
      filename = "~/data/audio/" @ %this.filename  ;  
      description =  %this.description;       
    }; 
  }  
  
  
}
 
function AudioProfileBehavior::onRemoveFromScene(%this){ 
    
}

