コード例 #1
0
ファイル: AudioUtils.cs プロジェクト: xav9211/Spider-speeder
 public static void Play(string resourceName,
                         float volume = 1.0f)
 {
     // surprisingly, that doesn't override background music, but rather
     // attaches new sound to the same AudioSource
     BackgroundMusic.PlayOneShot(LoadAudio(resourceName), volume);
 }
コード例 #2
0
        private void Awake()
        {
            var backgroundMusic = GameObject.Find("BackgroundMusic");

            if (backgroundMusic != null)
            {
                m_bgMusic = backgroundMusic.GetComponent <BackgroundMusic>();
                if (m_bgMusic != null)
                {
                    m_bgMusic.FadeOut();
                }
            }
        }
コード例 #3
0
 private void Awake()
 {
     if (Instance != null)
     {
         DestroyImmediate(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         Instance      = this;
         m_audioSource = GetComponent <AudioSource>();
         m_audioSource.ignoreListenerVolume = true;
     }
 }