From cc3df2e2a5cb7bb0bd831ab097e34bba255c5712 Mon Sep 17 00:00:00 2001 From: Talon Date: Sun, 18 Apr 2021 00:27:13 +0200 Subject: [PATCH] Initial debris --- .vs/EvilSatellites/v16/.suo | Bin 88576 -> 100352 bytes EvilSatellites/Objects/Debris.cs | 48 ++++++++++++++++ EvilSatellites/Objects/Satellite.cs | 8 +++ EvilSatellites/Screens/GameScreen.cs | 2 - EvilSatellites/SoundPatch.cs | 64 +++++++++++++++++++++ EvilSatellites/sfx/debris/1/loop.wav | 3 + EvilSatellites/sfx/ship/elevator/end.wav | 3 + EvilSatellites/sfx/ship/elevator/loop.wav | 3 + EvilSatellites/sfx/ship/elevator/start.wav | 3 + EvilSatellites/sfx/ship/turn/end.wav | 3 + EvilSatellites/sfx/ship/turn/loop.wav | 3 + EvilSatellites/sfx/ship/turn/start.wav | 3 + EvilSatellites/sfx/ship/vacuum/end.wav | 3 + EvilSatellites/sfx/ship/vacuum/loop.wav | 3 + EvilSatellites/sfx/ship/vacuum/start.wav | 3 + 15 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 EvilSatellites/Objects/Debris.cs create mode 100644 EvilSatellites/SoundPatch.cs create mode 100644 EvilSatellites/sfx/debris/1/loop.wav create mode 100644 EvilSatellites/sfx/ship/elevator/end.wav create mode 100644 EvilSatellites/sfx/ship/elevator/loop.wav create mode 100644 EvilSatellites/sfx/ship/elevator/start.wav create mode 100644 EvilSatellites/sfx/ship/turn/end.wav create mode 100644 EvilSatellites/sfx/ship/turn/loop.wav create mode 100644 EvilSatellites/sfx/ship/turn/start.wav create mode 100644 EvilSatellites/sfx/ship/vacuum/end.wav create mode 100644 EvilSatellites/sfx/ship/vacuum/loop.wav create mode 100644 EvilSatellites/sfx/ship/vacuum/start.wav diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 4cfe74567f3d88de80d0a2e1e3a8d68be563df20..1201c0662358899e7b64912282dfe0fe18141fbd 100644 GIT binary patch delta 5082 z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F6@);$Y;V7`4D`ShCTQZ8cwv4Ri>L;7Xy(oG hyAvU2dHC}>A0kt0kE*7O3YVm9vtL_AmkIAW|L@_r9Ay9i 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