예제 #1
0
    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);
    }
예제 #2
0
        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);
        }