I need to make a game for school.
I was adding some sound effects and music.
I have the paths to the .wav in the class and it will play them, but only when I start the game from the bin map in the project. I figgered out that the files are not included inside off the build. I started looking for it but could not find the correct way for it.
I have:
MediaPlayer _musicPlayer = new MediaPlayer();
string s = System.IO.Packaging.PackUriHelper.UriSchemePack;
Uri uri = new Uri(@"pack://application:,,,/{Assembly name};component/Resources/Sounds/Music/Main_theme_-_Thiago_Adamo.wav")
_musicPlayer.Open(uri);
_musicPlayer.Play();
This however does not work. If I add an messagebox with:
uri.IsFile.ToString()
It displays false.
On the file I set the propeties to be:
Build Action: Resource
Copy To Output Directory: Copy Always
I hope someone can help me.