Initial debris

This commit is contained in:
2021-04-18 00:27:13 +02:00
parent d99cbe3211
commit cc3df2e2a5
15 changed files with 150 additions and 2 deletions
Binary file not shown.
+48
View File
@@ -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();
}
}
}
+8
View File
@@ -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));
}
}
}
-2
View File
@@ -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;
}
+64
View File
@@ -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();
}
}
}
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bde132be8e48d341bfdf27b345a17285d80a6b80208e8fb81c2676f79f0c055b
size 384244
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88f8bc6be5b09ea0ef296389eb9ea7865e8089dc24befe6e6411f90440cd4382
size 235776
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fca64c729c38e467addc7f47bc3a043d5555341b660b64d85f3e392ebc3f43af
size 577900
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:17ea1c804e10b1c9c3a3d60b7cad97a54d2727341afb14c735708ccdf81cae4d
size 49732
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6885f60dcf9e1a2d49fa4b9bd6ab2f657e8e3cc00764b2b947d955843ef96227
size 57824
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a8f47b81fc72e6e474d1233b5c59d8339be34558b367553b2d5a4c4dc303490
size 540648
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b0c90f42d7a03737210ec65e7ab0f1b95bc5ed7ea34c44db6d0f196be2a6da7d
size 46768
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e77b8f1eaeb2b2607132cc43d9046ad3d56177202454f4ae5d35742d54340586
size 96104
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:865ed11ccfdca229def0fd1728166669d51cee6310c0d4d25d839b7878b86a3b
size 384104
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e36997d01bf4ec1c9356db9e73543a8ca9af92c92f55cbacc03b0dc0f2bb45a9
size 96104