protected new AudioSource audio; // = GetComponent<AudioSource>(); public static SoundFadeIn Add( GameObject gameObject, float duration = 1f, FinishNotify finishNotify = null) { SoundFadeIn fadeIn = gameObject.AddComponent <SoundFadeIn>(); fadeIn.duration = duration; fadeIn.onFinish = finishNotify; return(fadeIn); }
public override void Load() { _song = Context.AssetLoader.Get <SoundFile>("ElectricSleepMainMenu.wav"); SoundLayer layer = Context.SoundManager.CreateLayer("example"); Source source = Context.SoundManager.PlayOnLayer("example", _song); source.Looping = true; source.OnFinished += (e, a) => { Debugger.Log(MessageType.Info, MessageSource.Game, "Sound is over."); }; SoundFadeIn effectTest = new SoundFadeIn(5000, Context.SoundManager.GetLayer("example")); layer.ApplySoundEffect(effectTest); }