Ejemplo n.º 1
0
        private ISoundVoice StartNewMoodSound(MoodSoundKey currentMood)
        {
            if (_currentlyPlayingMoodSound != null)
            {
                if (_currentlyPlayingMoodSound.IsPlaying)
                {
                    _currentlyPlayingMoodSound.Stop(5000);
                    _currentlyPlayingMoodSound = null;
                }
            }

            //MoodsSounds.Keys[1].
            List <IUtopiaSoundSource> soundSource;

            if (MoodsSounds.TryGetValue(currentMood, out soundSource))
            {
                IUtopiaSoundSource sound = soundSource[_rnd.Next(0, soundSource.Count)];
                _currentlyPlayingMoodSound = SoundEngine.StartPlay2D(sound.Alias, SourceCategory.Music, false, 5000);
                return(_currentlyPlayingMoodSound);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        private void InsertMoodSound(MoodsSoundSource sound, TimeOfDaySound timeofDay, MoodType type)
        {
            MoodSoundKey key = new MoodSoundKey()
            {
                TimeOfDay = timeofDay, Type = type
            };
            List <IUtopiaSoundSource> soundList;

            if (this.MoodsSounds.TryGetValue(key, out soundList) == false)
            {
                soundList = new List <IUtopiaSoundSource>();
                this.MoodsSounds.Add(key, soundList);
            }
            soundList.Add(sound);
        }
Ejemplo n.º 3
0
        private void MoodSoundProcessing(ICharacterEntity player)
        {
            MoodSoundKey currentMood = new MoodSoundKey()
            {
                TimeOfDay = GetTimeofDay(), Type = GetMoodType(player)
            };

            //No sound was playing, or a new one needs to be played
            if (_currentlyPlayingMoodSound == null ||
                _currentlyPlayingMoodSound.IsPlaying == false ||
                _previousMood == null ||
                _previousMood != currentMood)
            {
                StartNewMoodSound(currentMood);
                _previousMood = currentMood;
            }
        }
Ejemplo n.º 4
0
        public override bool Equals(object obj)
        {
            MoodSoundKey objTyped = (MoodSoundKey)obj;

            return(objTyped == this);
        }