gunshot fixes

This commit is contained in:
SergoDobro 2023-08-18 11:53:23 +03:00
parent 088d9cb87c
commit 2d76a9bc14
7 changed files with 89 additions and 36 deletions

View file

@ -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

View file

@ -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"
}

View file

@ -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"
}

Binary file not shown.

View file

@ -136,6 +136,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
{
if (!isShooting)
{
AppManager.Instance.SoundManager.StartSound("shotgun_shot", Pos, Pos);
isShooting = true;
bullets--;
if (isRight)

View file

@ -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<SoundEffect>(soundFile).CreateInstance());
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("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]);
}