Exemple #1
0
        public override void Update()
        {
            if (backgroundMusic.Music.Status == SoundStatus.Stopped)
            {
                backgroundMusic = getRandomSong();
                backgroundMusic.Play();
            }

            foreach (string audioFile in engine.Playlist)
            {
                if (audioFile == Assets.GemSound)
                {
                    gemSound.Volume = Settings.Volume;
                    gemSound.Play();
                }
                else if (audioFile == Assets.DestroyerSound)
                {
                    destroyerSound.Volume = Settings.Volume;
                    destroyerSound.Play();
                }
                else if (audioFile == Assets.BoomSound)
                {
                    boomSound.Volume = Settings.Volume;
                    boomSound.Play();
                }
            }

            engine.Playlist.Clear();
        }
Exemple #2
0
        public SoundSystem(Engine e) : base(e)
        {
            random = new Random();

            backgroundMusic = getRandomSong();
            backgroundMusic.Play();

            gemSound       = new Sound(new SoundBuffer(Assets.GemSound));
            destroyerSound = new Sound(new SoundBuffer(Assets.DestroyerSound));
            boomSound      = new Sound(new SoundBuffer(Assets.BoomSound));
        }