Satellite explosions
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user