예제 #1
0
 public static void StopLoopingSound(this AudioSource audioSource)
 {
     if (CheckAudioSourceAndClip(audioSource))
     {
         SoundManager2.StopLoopingSound(audioSource);
     }
 }
예제 #2
0
 public static void PlayLoopingMusic(this AudioSource audioSource, float volume = 1)
 {
     if (audioSource != null)
     {
         SoundManager2.PlayLoopingMusic(audioSource, volume);
     }
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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);
            }
        }
예제 #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;
        }