From 29cf5eb0c9e262fe009da6359349c4b33d1d47d7 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Mon, 2 Mar 2020 15:15:35 -0500 Subject: [PATCH] add short music loop to demo stage GitOrigin-RevId: 7ea3d773b12341eb3eb3aabd9000cc32014faac8 --- Shared/SneakGame.cs | 5 +++++ Shared/SoundEffects.cs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Shared/SneakGame.cs b/Shared/SneakGame.cs index 72f6dfd..e10ad51 100644 --- a/Shared/SneakGame.cs +++ b/Shared/SneakGame.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonoGame.Framework.Utilities; @@ -67,6 +68,10 @@ namespace SemiColinGames { SoundEffects.Load(Content); Textures.Load(Content); linesOfSight = new LinesOfSight(GraphicsDevice); + SoundEffectInstance music = SoundEffects.IntroMusic.CreateInstance(); + music.IsLooped = true; + music.Volume = 0.1f; + music.Play(); LoadLevel(); } diff --git a/Shared/SoundEffects.cs b/Shared/SoundEffects.cs index b6b9645..067a69d 100644 --- a/Shared/SoundEffects.cs +++ b/Shared/SoundEffects.cs @@ -4,9 +4,11 @@ using Microsoft.Xna.Framework.Content; namespace SemiColinGames { public static class SoundEffects { + public static SoundEffect IntroMusic; public static SoundEffect[] SwordSwings = new SoundEffect[4]; public static void Load(ContentManager content) { + IntroMusic = content.Load("music/playonloop/smash_bros_short"); SwordSwings[0] = content.Load("sfx/zapsplat/sword_whoosh_1"); SwordSwings[1] = content.Load("sfx/zapsplat/sword_whoosh_2"); SwordSwings[2] = content.Load("sfx/zapsplat/sword_whoosh_3");