Exemplo n.º 1
0
        /// <summary>
        /// Removes an element from the music stack. If this was the top element, this will trigger a transition to the next element.
        /// </summary>
        public void RemoveFromMusicStack(PrioritySortingKey key)
        {
            Asserts.AssertTrue(musicStack.ContainsKey(key), "This key is not in the music stack!");
            var  keyMusic           = musicStack[key];
            bool wasPlayingKeyMusic = keyMusic == currentMusic;

            musicStack.Remove(key);
            if (wasPlayingKeyMusic)
            {
                TransitionToMusic(keyMusic, currentMusic, keyMusic.GetReleaseControlTransition());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds an elment to the music stack. If this becomes the top element, it will transition to these music settings.
        /// </summary>
        public PrioritySortingKey AddToMusicStack(IMusicStackElement addedMusic)
        {
            var prevMusic = currentMusic;

            var newKey = new PrioritySortingKey((int)addedMusic.GetPriority());

            musicStack.Add(newKey, addedMusic);

            if (currentMusic != prevMusic)
            {
                Asserts.AssertTrue(addedMusic == currentMusic, "Somehow we added to the music stack and yet a different music rose to the top?");
                TransitionToMusic(prevMusic, currentMusic, currentMusic.GetTakeControlTransition());
            }
            return(newKey);
        }
Exemplo n.º 3
0
 private void Start()
 {
     musicStackKey = MusicStack.instance.AddToMusicStack(musicConfig);
 }