diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 4cfe745..1201c06 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites/Objects/Debris.cs b/EvilSatellites/Objects/Debris.cs new file mode 100644 index 0000000..f2978d3 --- /dev/null +++ b/EvilSatellites/Objects/Debris.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using SynthySound; +using EvilSatellites.Screens; + +namespace EvilSatellites.Objects +{ + public class Debris : AbstractGameObject + { + private ISoundEffect3D Sound; + + public Debris(IScreen screen, Vector3 pos) : base(screen) + { + Sound = Screen.Manager.Sound.Load3D(@"sfx/debris/1/loop.wav"); + Sound.Loop = true; + Position = pos; + Dimensions = new Vector3(5, 5, 5); + Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z); + Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect); + Activate(); + } + + public override void Activate() + { + Sound.Play(); + Active = true; + ShouldDestroy = false; + } + public override void Destroy() + { + Sound.Destroy(); + } + + override public void Update(GameTime gameTime) + { + Sound.Position = new System.Numerics.Vector3(Position.X, Position.Y, Position.Z); + } + + public override void OnCollision(IGameObject obj) + { + Sound.Stop(); + } + } +} diff --git a/EvilSatellites/Objects/Satellite.cs b/EvilSatellites/Objects/Satellite.cs index 97b50a8..79e6d71 100644 --- a/EvilSatellites/Objects/Satellite.cs +++ b/EvilSatellites/Objects/Satellite.cs @@ -14,6 +14,7 @@ namespace EvilSatellites.Objects private ISoundEffect3D Sound; private int Health; private int SatelliteID; + private Random rnd = new Random(); public Satellite(IScreen screen, Vector3 pos, int satelliteID = 1) : base(screen) { Type = ObjectType.Satellite; @@ -52,8 +53,15 @@ namespace EvilSatellites.Objects if (Health <= 0) { Screen.Manager.Sound.PlayOneshot(@"sfx/satellite/"+SatelliteID.ToString()+"/explode.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z)); + SpawnDebris(); Destroy(); } } + + public void SpawnDebris() + { + var screen = (GameScreen)Screen; + screen.AddObject(new Debris(screen, Position)); + } } } diff --git a/EvilSatellites/Screens/GameScreen.cs b/EvilSatellites/Screens/GameScreen.cs index 82c9b9f..f5f9103 100644 --- a/EvilSatellites/Screens/GameScreen.cs +++ b/EvilSatellites/Screens/GameScreen.cs @@ -31,7 +31,6 @@ namespace EvilSatellites.Screens _player = player; Satellite prop = new Satellite(this, new Vector3(15, 0, 15)); Objects.Add(prop); - if (_player == null) Environment.Exit(1); ObjectRadar = new Radar(_player, this); return; } @@ -78,7 +77,6 @@ namespace EvilSatellites.Screens } UpdateRadar(); CheckCollisions(); - return; } diff --git a/EvilSatellites/SoundPatch.cs b/EvilSatellites/SoundPatch.cs new file mode 100644 index 0000000..015e0c1 --- /dev/null +++ b/EvilSatellites/SoundPatch.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SynthySound; +using Microsoft.Xna.Framework; + +namespace EvilSatellites +{ + public class SoundPatch + { + public Synthy _engine; + public ISoundEffect sndStart; + public ISoundEffect sndLoop; + public ISoundEffect sndStop; + public double StartTime; + public double currTime; + public double StartSoundTime; + public bool Starting; + public SoundPatch(Synthy engine, string path, float startSoundTime) + { + _engine = engine; + sndStart = _engine.Load(path + "/start.wav", false); + sndLoop = engine.Load(path + "/loop.wav", false); + sndStop = engine.Load(path + "/end.wav", false); + sndLoop.Loop = true; + Starting = false; + StartSoundTime = startSoundTime; + } + + public void Start(GameTime time) + { + sndStart.Reset(); + sndStart.Play(); + currTime = time.TotalGameTime.TotalMilliseconds; + StartTime = time.TotalGameTime.TotalMilliseconds; + Starting = true; + } + + public void Update(GameTime time) + { + currTime += time.ElapsedGameTime.TotalMilliseconds; + if (Starting) + { + if (currTime - StartTime > StartSoundTime) + { + + Starting = false; + sndLoop.Play(); + } + } + } + + public void Stop() + { + Starting = false; + sndStart.Pause(); + sndLoop.Pause(); + sndStop.Reset(); + sndStop.Play(); + } + } +} diff --git a/EvilSatellites/sfx/debris/1/loop.wav b/EvilSatellites/sfx/debris/1/loop.wav new file mode 100644 index 0000000..229b7df --- /dev/null +++ b/EvilSatellites/sfx/debris/1/loop.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bde132be8e48d341bfdf27b345a17285d80a6b80208e8fb81c2676f79f0c055b +size 384244 diff --git a/EvilSatellites/sfx/ship/elevator/end.wav b/EvilSatellites/sfx/ship/elevator/end.wav new file mode 100644 index 0000000..1294078 --- /dev/null +++ b/EvilSatellites/sfx/ship/elevator/end.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88f8bc6be5b09ea0ef296389eb9ea7865e8089dc24befe6e6411f90440cd4382 +size 235776 diff --git a/EvilSatellites/sfx/ship/elevator/loop.wav b/EvilSatellites/sfx/ship/elevator/loop.wav new file mode 100644 index 0000000..05447d3 --- /dev/null +++ b/EvilSatellites/sfx/ship/elevator/loop.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fca64c729c38e467addc7f47bc3a043d5555341b660b64d85f3e392ebc3f43af +size 577900 diff --git a/EvilSatellites/sfx/ship/elevator/start.wav b/EvilSatellites/sfx/ship/elevator/start.wav new file mode 100644 index 0000000..da1d3dc --- /dev/null +++ b/EvilSatellites/sfx/ship/elevator/start.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17ea1c804e10b1c9c3a3d60b7cad97a54d2727341afb14c735708ccdf81cae4d +size 49732 diff --git a/EvilSatellites/sfx/ship/turn/end.wav b/EvilSatellites/sfx/ship/turn/end.wav new file mode 100644 index 0000000..c361981 --- /dev/null +++ b/EvilSatellites/sfx/ship/turn/end.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6885f60dcf9e1a2d49fa4b9bd6ab2f657e8e3cc00764b2b947d955843ef96227 +size 57824 diff --git a/EvilSatellites/sfx/ship/turn/loop.wav b/EvilSatellites/sfx/ship/turn/loop.wav new file mode 100644 index 0000000..5114595 --- /dev/null +++ b/EvilSatellites/sfx/ship/turn/loop.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a8f47b81fc72e6e474d1233b5c59d8339be34558b367553b2d5a4c4dc303490 +size 540648 diff --git a/EvilSatellites/sfx/ship/turn/start.wav b/EvilSatellites/sfx/ship/turn/start.wav new file mode 100644 index 0000000..df5080d --- /dev/null +++ b/EvilSatellites/sfx/ship/turn/start.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0c90f42d7a03737210ec65e7ab0f1b95bc5ed7ea34c44db6d0f196be2a6da7d +size 46768 diff --git a/EvilSatellites/sfx/ship/vacuum/end.wav b/EvilSatellites/sfx/ship/vacuum/end.wav new file mode 100644 index 0000000..999edba --- /dev/null +++ b/EvilSatellites/sfx/ship/vacuum/end.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e77b8f1eaeb2b2607132cc43d9046ad3d56177202454f4ae5d35742d54340586 +size 96104 diff --git a/EvilSatellites/sfx/ship/vacuum/loop.wav b/EvilSatellites/sfx/ship/vacuum/loop.wav new file mode 100644 index 0000000..1a54fa6 --- /dev/null +++ b/EvilSatellites/sfx/ship/vacuum/loop.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:865ed11ccfdca229def0fd1728166669d51cee6310c0d4d25d839b7878b86a3b +size 384104 diff --git a/EvilSatellites/sfx/ship/vacuum/start.wav b/EvilSatellites/sfx/ship/vacuum/start.wav new file mode 100644 index 0000000..b78e24e --- /dev/null +++ b/EvilSatellites/sfx/ship/vacuum/start.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e36997d01bf4ec1c9356db9e73543a8ca9af92c92f55cbacc03b0dc0f2bb45a9 +size 96104