Beispiel #1
0
        public void PlayMusic(MusicPhase musicPhase)
        {
            GetSoundsGroup(musicPhase).PlayRandomClip();

            // fade musics
            GetSoundsGroup(musicPhase).SmoothAmplify(_fadeDuration);
            GetOppositeSoundsGroup(musicPhase).SmoothMute(_fadeDuration);
        }
Beispiel #2
0
        public static MusicPhase GetOppositeMusicPhase(this MusicPhase musicPhase)
        {
            switch (musicPhase)
            {
            case MusicPhase.Construction:
                return(MusicPhase.Defend);

            case MusicPhase.Defend:
                return(MusicPhase.Construction);

            default:
                throw new System.NotImplementedException("Music phase was " + musicPhase);
            }
        }
Beispiel #3
0
        /// We could remove this method by using a dictionary.
        /// But I find it very overkill to use a dictionary for 2 values.
        ///
        /// Moreover, using a dictionary means a no official way to serialize it, maybe leading to problems.
        SoundGroup GetSoundsGroup(MusicPhase musicPhase)
        {
            switch (musicPhase)
            {
            case MusicPhase.Construction:
                return(_constructionMusics);

            case MusicPhase.Defend:
                return(_defendMusics);

            default:
                throw new System.NotImplementedException("Music phase was " + musicPhase);
            }
        }
Beispiel #4
0
 SoundGroup GetOppositeSoundsGroup(MusicPhase musicPhase) => GetSoundsGroup(musicPhase.GetOppositeMusicPhase());