Beispiel #1
0
 private void setupAudioController(TWAudioLibrary library, TWAudioSourceLibrary audioSources, GameObject audioParent)
 {
     instance.audioSources = audioSources;
     instance.audioSources.Init();
     instance.audioLibrary = library;
     instance.audioParent  = audioParent;
 }
        void Awake()
        {
            audioController = GetComponent <TWAudioController>();
            audioLibrary    = GetComponent <TWAudioLibrary>();

            audioController.CreateInstance();
            TWAudioController.SetUpController(audioLibrary);
        }
        void Awake()
        {
            if (TWAudioController.Instance == null)
            {
                audioController = GetComponent <TWAudioController>();
                audioLibrary    = GetComponent <TWAudioLibrary>();

                audioController.CreateInstance();
                TWAudioController.SetupAudioLibrary(audioLibrary, audioSources, audioParent);
            }

            else
            {
                Destroy(gameObject);
            }
        }
        private void setUpController(TWAudioLibrary library, int bgmChannel)
        {
            instance.bgmQueue = new TWAudioQueue();
            instance.bgmQueue.Init();
            instance.coroutines = new Coroutine[bgmChannel];

            for (int i = 0; i < bgmChannel; i++)
            {
                AudioSource source = instance.gameObject.AddComponent <AudioSource>();
                source.playOnAwake = false;
                source.loop        = false;
                instance.bgmQueue.AddSourceQueue(source);
            }

            instance.sfxSource             = instance.gameObject.AddComponent <AudioSource>();
            instance.sfxSource.playOnAwake = false;
            instance.sfxSource.loop        = false;

            instance.audioLibrary = library;
        }
 public static void SetUpController([NotNull] TWAudioLibrary library)
 {
     // Only support 2 channel for fading
     Instance?.setUpController(library, 2);
     Instance?.SetTimeFade();
 }
Beispiel #6
0
 public static void SetupAudioLibrary([NotNull] TWAudioLibrary library, TWAudioSourceLibrary audioSources, GameObject audioParent)
 {
     // Only support 2 channel for fading
     Instance?.setupAudioController(library, audioSources, audioParent);
     Instance?.SetTimeFade();
 }