Exemple #1
0
 public static void StopLoopingSound(this AudioSource audioSource)
 {
     if (CheckAudioSourceAndClip(audioSource))
     {
         SoundManager2.StopLoopingSound(audioSource);
     }
 }
Exemple #2
0
 public static void PlayLoopingMusic(this AudioSource audioSource, float volume = 1)
 {
     if (audioSource != null)
     {
         SoundManager2.PlayLoopingMusic(audioSource, volume);
     }
 }
Exemple #3
0
 public static void PlayLoopingSound(this AudioSource audioSource, Vector3 position, float volume = 1)
 {
     if (CheckAudioSourceAndClip(audioSource))
     {
         SoundManager2.PlayLoopingSound(audioSource, audioSource.clip, volume, position, true);
     }
 }
Exemple #4
0
 public static void PlaySound(this AudioSource audioSource, Vector3 position, AudioRolloffMode audioRollofMode, float spatialBlend = 1, float volume = 1)
 {
     if (CheckAudioSourceAndClip(audioSource))
     {
         SoundManager2.PlaySound(audioSource, audioSource.clip, volume, position, true, spatialBlend, audioRollofMode);
     }
 }
Exemple #5
0
        public static void PlaySound(this AudioSource audioSource, float volume = 1)
        {
            Vector3 position = Vector3.zero;

            if (CheckAudioSourceAndClip(audioSource))
            {
                SoundManager2.PlaySound(audioSource, audioSource.clip, volume, position, false, 0, AudioRolloffMode.Logarithmic);
            }
        }
Exemple #6
0
        public static void Instantiate()
        {
            if (instance != null)
            {
                Debug.LogWarning("Trying to instantiate SounManager, 2nd time");
                return;
            }

            rootGo           = new GameObject();
            rootGo.name      = "Sound Manager";
            rootGo.hideFlags = HideFlags.DontSave;
            instance         = rootGo.AddComponent <SoundManager2>();
            DontDestroyOnLoad(rootGo);
            instantiated = true;
        }