diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index 853f5ee..616c002 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -122,6 +122,18 @@ /processorParam:Quality=Best /build:sounds/Zombi stoit.wav +#begin sounds/zombie sound 2.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:sounds/zombie sound 2.wav + +#begin sounds/zombie sound.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:sounds/zombie sound.wav + #begin Textures/Animations/player_down_idle.animation /copy:Textures/Animations/player_down_idle.animation diff --git a/ZoFo/Content/sounds/zombie sound 2.wav b/ZoFo/Content/sounds/zombie sound 2.wav new file mode 100644 index 0000000..d3df275 Binary files /dev/null and b/ZoFo/Content/sounds/zombie sound 2.wav differ diff --git a/ZoFo/Content/sounds/zombie sound.wav b/ZoFo/Content/sounds/zombie sound.wav new file mode 100644 index 0000000..c4f351d Binary files /dev/null and b/ZoFo/Content/sounds/zombie sound.wav differ diff --git a/ZoFo/GameCore/GameManagers/SettingsManager.cs b/ZoFo/GameCore/GameManagers/SettingsManager.cs index 66f252b..13d870a 100644 --- a/ZoFo/GameCore/GameManagers/SettingsManager.cs +++ b/ZoFo/GameCore/GameManagers/SettingsManager.cs @@ -28,13 +28,14 @@ namespace ZoFo.GameCore.GameManagers public void SetMainVolume(float volume) { settingsContainer.MainVolume = volume; - AppManager.Instance.SoundManager.Update(); + // AppManager.Instance.SoundManager.Update(); SaveSettings(); } public void SetMusicVolume(float volume) { settingsContainer.MusicVolume = volume; //AppManager.Instance.SoundManager.Update(); + SaveSettings(); } @@ -70,6 +71,7 @@ namespace ZoFo.GameCore.GameManagers } public void SaveSettings() { + AppManager.Instance.SoundManager.Update(); using (StreamWriter streamWriter = new StreamWriter("GameSettings.txt")) { string _str = JsonConvert.SerializeObject(settingsContainer); diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs index 09db9b5..e427e94 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs @@ -36,15 +36,36 @@ namespace ZoFo.GameCore.GameObjects public override void Update() { - Vector2 duration = Vector2.Normalize( - AppManager.Instance.server.players[0].position - position + float m = 10000000; + int j = -1; + for (int i = 0; i < AppManager.Instance.server.players.Count; i++) + { + var player = AppManager.Instance.server.players[i]; + if (m > (player.position.X - position.X) * (player.position.X - position.X) + (player.position.Y - position.Y) * (player.position.Y - position.Y)) + { + m = (player.position.X - position.X) * (player.position.X - position.X) + (player.position.Y - position.Y) * (player.position.Y - position.Y); + j = i; + } + } + Vector2 duration = Vector2.Zero; + if (m<= 130000) + { + duration = Vector2.Normalize( + AppManager.Instance.server.players[j].position - position ); + if (new Random().Next(0, 1000) == 0) + { + AppManager.Instance.SoundManager.StartSound("zombie sound", position, AppManager.Instance.server.players[0].position, pitch: new Random().Next(-1, 2) * (float)new Random().NextDouble()); + } + } - - - + if (!isAttacking) { velocity += new Vector2(duration.X * speed, duration.Y * speed); } + + + + } public void OnPlayerClose(GameObject sender) { @@ -52,6 +73,8 @@ namespace ZoFo.GameCore.GameObjects if(!isAttacking) { + + AppManager.Instance.SoundManager.StartSound("Zombi napal", position, AppManager.Instance.server.players[0].position,pitch:new Random().Next(-1,2)*(float)new Random().NextDouble()); StartAnimation("zombie_attack"); isAttacking = true; }