Satellite explosions

This commit is contained in:
2021-04-14 16:33:05 +02:00
parent 41b56258ef
commit 3e5809a98e
7 changed files with 20 additions and 6 deletions
+14 -3
View File
@@ -12,10 +12,13 @@ namespace EvilSatellites.Objects
public class Satellite : AbstractGameObject
{
private ISoundEffect3D Sound;
public Satellite(IScreen screen, Vector3 pos) : base(screen)
private int Health;
private int SatelliteID;
public Satellite(IScreen screen, Vector3 pos, int satelliteID = 1) : base(screen)
{
Type = ObjectType.Satellite;
Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/1/loop.wav");
SatelliteID = satelliteID;
Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/"+SatelliteID.ToString()+"/loop.wav");
Sound.Loop = true;
Position = pos;
Dimensions = new Vector3(5, 5, 5);
@@ -29,10 +32,13 @@ namespace EvilSatellites.Objects
Sound.Play();
Active = true;
ShouldDestroy = false;
Health = 100;
}
public override void Destroy()
{
Sound.Destroy();
ShouldDestroy = true;
Active = false;
}
override public void Update(GameTime gameTime)
@@ -42,7 +48,12 @@ namespace EvilSatellites.Objects
public override void OnCollision(IGameObject obj)
{
// Sound.Stop();
Health -= 10;
if (Health <= 0)
{
Screen.Manager.Sound.PlayOneshot(@"sfx/satellite/"+SatelliteID.ToString()+"/explode.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z));
Destroy();
}
}
}
}
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d67a5591a021c4f05ec01ce8d5f034fb0cf23b68fa8d9dc8130d6117ff3e754e
size 1870856
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:98706fa6dbbb6e0abb61a8db064d2b99c567379dda060111ea244c7a6a791657
oid sha256:67adab95fa1cfc1ca99f8405790dea19276e8026c199c7140ece6195e181832b
size 149636
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f729f67450f4a269dcb1a174b59abb3164596fbd4dc527ebcb54ccf82edee263
oid sha256:b0cdbed9b6065ceb09cbf304c03816e666c30d7a5611e4d9d631dc1bc078a4f8
size 21212
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e7edc195ba058b3213ea6b544d737e454311901fc16c5bb84741dd39981633f1
oid sha256:e09e2fe70cbbaf7aa331b7ab084b03f11137e98f40b71f35305e3c911eed05e7
size 159344