private void CrossFadeToClip(AudioCrossFade musicSource, AudioClip toPlay, float fadeTime)
        {
            var name = toPlay.name.Split('.')[0];

            if (ModConfig.Instance.MusicOffsets?.ContainsKey(name) ?? false)
            {
                musicSource.CrossFade(toPlay, ModConfig.Instance.ConfigFile.Volume, fadeTime, 0, ModConfig.Instance.MusicOffsets[name]);
            }
            else
            {
                musicSource.CrossFade(toPlay, ModConfig.Instance.ConfigFile.Volume, 0);
            }
        }
Beispiel #2
0
 public void Init()
 {
     MusicPlayer  = new LocalMusicPlayer(Manager);
     _audioPlayer = Manager.gameObject.GetComponent <AudioCrossFade>();
 }
 public LocalMusicPlayer(MonoBehaviour manager)
 {
     _manager        = manager;
     _audioCrossFade = _manager.gameObject.GetComponent <AudioCrossFade>();
     LoadMusic();
 }