Пример #1
0
    public void AddSoundEvent(string eventType, params string[] paramlist)
    {
        SoundEvent e = null;

        switch (eventType)
        {
        case "PlaySound":
            e = new PlaySFXEvent();
            break;

        case "StartSoundLoop":
            e = new StartSFXLoopEvent();
            break;

        case "StopSoundLoop":
            e = new StopSFXLoopEvent();
            break;

        case "StartMusic":
            e = new StartMusicEvent();
            break;

        case "StopMusic":
            e = new StopMusicEvent();
            break;

        case "FadeMusic":
            e = new FadeMusicEvent();
            break;
        }

        if (e != null)
        {
            e.Deserialize(paramlist);

            if (eventsDict.ContainsKey(e.name))
            {
                eventsDict[e.name].clip    = library.GetSoundFromLibrary(e.soundName);
                eventsDict[e.name].library = library;
            }
            else
            {
                e.clip    = library.GetSoundFromLibrary(e.soundName);
                e.library = library;
                eventsDict.Add(e.name, e);
            }
        }
    }
Пример #2
0
 private void StopSongIfItShouldStop(StopMusicEvent stopMusicEvent, Song testSong)
 {
     if (testSong == null)
     {
         return;
     }
     if (stopMusicEvent.prio < testSong.priority)
     {
         return;
     }
     if (stopMusicEvent.type == StopMusicEvent.Type.SpecificSong && testSong.name != stopMusicEvent.songName)
     {
         return;
     }
     if (stopMusicEvent.type == StopMusicEvent.Type.AllButSpecific && testSong.name == stopMusicEvent.songName)
     {
         return;
     }
     testSong.FadeOut(stopMusicEvent.fadeOutTime);
 }
Пример #3
0
 public new void GameRequestsSongStop(StopMusicEvent stopMusicEvent)
 {
     this.StopSongIfItShouldStop(stopMusicEvent, this.song);
     this.StopSongIfItShouldStop(stopMusicEvent, this.nextSong);
 }
Пример #4
0
 void StopMusic(StopMusicEvent e)
 {
     StopMusic(e.fade);
 }