private void On_SoundObject_SoundObjectWillGetDestroyed(SoundObject soundObject) { if (IS_VALUE_CONTAINED(aliveSoundObjects, soundObject)) { aliveSoundObjects.Remove(soundObject); } }
protected override void Awake() { base.Awake(); soundObjectPrefab = Resources.Load <SoundObject>(BConsts.PATH_SoundObject); IS_NOT_NULL(soundObjectPrefab); }
public SoundObject SpawnSoundObject(Transform transform, AudioClip audioClipToPlay, bool destroyWhenFinished = true, bool isLoop = false) { SoundObject soundObject = SpawnSoundObject(audioClipToPlay); if (soundObject) { soundObject.PlaySound(transform, audioClipToPlay, destroyWhenFinished, isLoop); } return(soundObject); }
public SoundObject SpawnSoundObject(Vector3 position, AudioClip audioClipToPlay, bool destroyWhenFinished = true, bool isLoop = false) { SoundObject soundObject = SpawnSoundObject(audioClipToPlay); if (soundObject) { soundObject.PlaySound(position, audioClipToPlay, destroyWhenFinished, isLoop); } return(soundObject); }
private SoundObject SpawnSoundObject(AudioClip audioClipToPlay) { if ((audioClipToPlay != null) && (IS_NOT_NULL(soundObjectPrefab))) { SoundObject soundObject = Instantiate(soundObjectPrefab); soundObject.gameObject.name = "SO_" + audioClipToPlay.name; aliveSoundObjects.Add(soundObject); soundObject.SoundObjectWillGetDestroyed += On_SoundObject_SoundObjectWillGetDestroyed; return(soundObject); } return(null); }