diff --git a/DangerousD/Content/Content.mgcb b/DangerousD/Content/Content.mgcb index 37d9842..d6828ea 100644 --- a/DangerousD/Content/Content.mgcb +++ b/DangerousD/Content/Content.mgcb @@ -21,18 +21,6 @@ /processorParam:TextureFormat=Compressed /build:ButtonFont.spritefont -#begin checkboxs_off-on.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:checkboxs_off-on.png - #begin checkboxs_off.png /importer:TextureImporter /processor:TextureProcessor @@ -45,6 +33,18 @@ /processorParam:TextureFormat=Color /build:checkboxs_off.png +#begin checkboxs_off-on.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:checkboxs_off-on.png + #begin checkboxs_on.png /importer:TextureImporter /processor:TextureProcessor @@ -81,12 +81,6 @@ /processorParam:TextureFormat=Color /build:deathBackground.jpg -#begin DoomTestSong.mp3 -/importer:Mp3Importer -/processor:SoundEffectProcessor -/processorParam:Quality=Best -/build:DoomTestSong.mp3 - #begin Font_12.spritefont /importer:FontDescriptionImporter /processor:FontDescriptionProcessor @@ -223,6 +217,18 @@ /processorParam:TextureFormat=Color /build:sliderBackground.png +#begin sounds/DoomTestSong.mp3 +/importer:Mp3Importer +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:sounds/DoomTestSong.mp3 + +#begin sounds/shotgun_shot.mp3 +/importer:Mp3Importer +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:sounds/shotgun_shot.mp3 + #begin textboxbackground1-1.png /importer:TextureImporter /processor:TextureProcessor @@ -235,18 +241,6 @@ /processorParam:TextureFormat=Color /build:textboxbackground1-1.png -#begin textboxbackground2-1.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:textboxbackground2-1.png - #begin textboxbackground2,5-1.png /importer:TextureImporter /processor:TextureProcessor @@ -259,6 +253,18 @@ /processorParam:TextureFormat=Color /build:textboxbackground2,5-1.png +#begin textboxbackground2-1.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:textboxbackground2-1.png + #begin textboxbackground6-1.png /importer:TextureImporter /processor:TextureProcessor diff --git a/DangerousD/Content/animations/playerShootLeft b/DangerousD/Content/animations/playerShootLeft index f2b9f3b..e710737 100644 --- a/DangerousD/Content/animations/playerShootLeft +++ b/DangerousD/Content/animations/playerShootLeft @@ -1 +1,24 @@ -{"id":"playerShootLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":201,"Y":34,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"4, 0"} +{ + "id": "playerShootLeft", + "textureName": "playerAnimation", + "startSpriteRectangle": { + "X": 201, + "Y": 34, + "Width": 32, + "Height": 32 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 3 + }, + { + "Item1": 1, + "Item2": 20 + } + ], + "textureFrameInterval": 1, + "framesCount": 2, + "isCycle": false, + "offset": "4, 0" +} diff --git a/DangerousD/Content/animations/playerShootRight b/DangerousD/Content/animations/playerShootRight index 922862b..3b7ef81 100644 --- a/DangerousD/Content/animations/playerShootRight +++ b/DangerousD/Content/animations/playerShootRight @@ -1 +1,24 @@ -{"id":"playerShootRight","textureName":"playerAnimation","startSpriteRectangle":{"X":201,"Y":1,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"4, 0"} +{ + "id": "playerShootRight", + "textureName": "playerAnimation", + "startSpriteRectangle": { + "X": 201, + "Y": 1, + "Width": 32, + "Height": 32 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 3 + }, + { + "Item1": 1, + "Item2": 20 + } + ], + "textureFrameInterval": 1, + "framesCount": 2, + "isCycle": false, + "offset": "4, 0" +} diff --git a/DangerousD/Content/DoomTestSong.mp3 b/DangerousD/Content/sounds/DoomTestSong.mp3 similarity index 100% rename from DangerousD/Content/DoomTestSong.mp3 rename to DangerousD/Content/sounds/DoomTestSong.mp3 diff --git a/DangerousD/Content/sounds/shotgun_shot.mp3 b/DangerousD/Content/sounds/shotgun_shot.mp3 new file mode 100644 index 0000000..56a4a56 Binary files /dev/null and b/DangerousD/Content/sounds/shotgun_shot.mp3 differ diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 272f332..2d07720 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -136,6 +136,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { if (!isShooting) { + AppManager.Instance.SoundManager.StartSound("shotgun_shot", Pos, Pos); isShooting = true; bullets--; if (isRight) diff --git a/DangerousD/GameCore/Managers/SoundManager.cs b/DangerousD/GameCore/Managers/SoundManager.cs index ab9a5d8..70352c4 100644 --- a/DangerousD/GameCore/Managers/SoundManager.cs +++ b/DangerousD/GameCore/Managers/SoundManager.cs @@ -19,7 +19,7 @@ namespace DangerousD.GameCore public void LoadSounds() // метод для загрузки звуков из папки { - var k = Directory.GetFiles("../../..//Content").Where(x => x.EndsWith("mp3")); + var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("mp3")); if (k.Count() > 0) { @@ -27,7 +27,7 @@ namespace DangerousD.GameCore string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe foreach (var soundFile in soundFiles) { - Sounds.Add(soundFile, AppManager.Instance.Content.Load(soundFile).CreateInstance()); + Sounds.Add(soundFile, AppManager.Instance.Content.Load("sounds//" + soundFile).CreateInstance()); } } @@ -53,7 +53,7 @@ namespace DangerousD.GameCore { var sound = new Sound(Sounds[soundName], soundPos); sound.SoundEffect.IsLooped = false; - sound.SoundEffect.Volume = (float)sound.GetDistance(playerPos) / MaxSoundDistance; + sound.SoundEffect.Volume = (float)(MaxSoundDistance-sound.GetDistance(playerPos)) / MaxSoundDistance; sound.SoundEffect.Play(); PlayingSounds.Add(sound); if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host) @@ -79,7 +79,7 @@ namespace DangerousD.GameCore for (int i = 0; i < PlayingSounds.Count; i++) { if (!PlayingSounds[i].isAmbient) - PlayingSounds[i].SoundEffect.Volume = (float)PlayingSounds[i].GetDistance(player.Pos) / MaxSoundDistance; + PlayingSounds[i].SoundEffect.Volume = (float)(MaxSoundDistance - PlayingSounds[i].GetDistance(player.Pos)) / MaxSoundDistance; if (PlayingSounds[i].SoundEffect.State == SoundState.Stopped) PlayingSounds.Remove(PlayingSounds[i]); }