using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework; using Util; namespace FaceOff { class SoundManager { List Sounds = new List(); public void LoadContent(ContentManager content) { // this is the hardcoded part where sounds are added //please dont use the same name twice unless you want two sounds to play together Sounds.Add(new Sound("progress", "Audio\\progress", content)); Sounds.Add(new Sound("right", "Audio\\right", content)); Sounds.Add(new Sound("wrong", "Audio\\wrong", content)); } public void PlaySound(string name) { foreach (Sound s in Sounds) { if (s.Name.Equals(name)) { s.play(); } } } } class Sound { string name; public string Name { get { return name; } set { name = value; } } string filepath; SoundEffect mySound; public Sound(string newname, string newfilepath, ContentManager content) { name = newname; filepath = newfilepath; LoadSound(content); } public void LoadSound(ContentManager content) { mySound = content.Load(filepath); } public void play() { mySound.Play(); } } }