Dart Documentationsimple_audioAudioDef

AudioDef class

Component use to store a bag of name of AudioClip to play. When the System_Audio start to play, name is removed from the bag. System_Audio start to play ASAP.

class AudioDef extends ComponentPoolable {
 final l = new LinkedBag<String>();

 /// only one entity can be the audioListener at time t.
 var isAudioListener = false;

 AudioDef._();
 static _ctor() => new AudioDef._();
 factory AudioDef() {
   var c = new Poolable.of(AudioDef, _ctor);
   c.cleanUp();
   return c;
 }

 void cleanUp() {
   l.clear();
   isAudioListener = false;
 }

 /// this is a sugar method for [l].add([a])
 /// sugar because you can write
 ///
 ///    new AudioDef()
 ///      ..add("boost")
 ///      ..add("alarm")
 ///
 AudioDef add(String a) {
   l.add(a);
   return this;
 }
}

Extends

Component > Component_Poolable > ComponentPoolable > AudioDef

Constructors

factory AudioDef() #

factory AudioDef() {
 var c = new Poolable.of(AudioDef, _ctor);
 c.cleanUp();
 return c;
}

Properties

var isAudioListener #

only one entity can be the audioListener at time t.

var isAudioListener = false

final l #

final l = new LinkedBag<String>()

Methods

AudioDef add(String a) #

this is a sugar method for l.add( a) sugar because you can write

new AudioDef()

 ..add("boost")
 ..add("alarm")
AudioDef add(String a) {
 l.add(a);
 return this;
}

void cleanUp() #

If you need to do some cleanup when removing this component override this method.

docs inherited from ComponentPoolable
void cleanUp() {
 l.clear();
 isAudioListener = false;
}

void moveToPool() #

inherited from Component_Poolable

Calls the cleanup function and moves this object to the ObjectPool.

void moveToPool() {
 cleanUp();
 ObjectPool.add(this);
}