Lots of stuff
This commit is contained in:
@@ -12,14 +12,19 @@ namespace EvilSatellites.Objects
|
||||
public class Debris : AbstractGameObject
|
||||
{
|
||||
private ISoundEffect3D Sound;
|
||||
|
||||
private Random rnd = new Random();
|
||||
private Vector3 MovementVector;
|
||||
public Debris(IScreen screen, Vector3 pos) : base(screen)
|
||||
{
|
||||
Type = ObjectType.Debris;
|
||||
Sound = Screen.Manager.Sound.Load3D(@"sfx/debris/1/loop.wav");
|
||||
Sound.Loop = true;
|
||||
Sound.Pitch = 0.9 + (float)rnd.NextDouble()*2;
|
||||
Position = pos;
|
||||
Dimensions = new Vector3(5, 5, 5);
|
||||
Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z);
|
||||
MovementVector = new Vector3(-0.02f + (float)rnd.NextDouble() * 0.01f, -0.02f + (float)rnd.NextDouble() * 0.01f, -0.02f + (float) rnd.NextDouble() * 0.01f);
|
||||
Rotation = Matrix.CreateFromAxisAngle(new Vector3(0, 0, 1), 0);
|
||||
Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||
Activate();
|
||||
}
|
||||
@@ -33,16 +38,29 @@ namespace EvilSatellites.Objects
|
||||
public override void Destroy()
|
||||
{
|
||||
Sound.Destroy();
|
||||
ShouldDestroy = true;
|
||||
Active = false;
|
||||
}
|
||||
|
||||
override public void Update(GameTime gameTime)
|
||||
{
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X, Position.Y, Position.Z);
|
||||
Move(MovementVector);
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2);
|
||||
}
|
||||
|
||||
public override void OnCollision(IGameObject obj)
|
||||
{
|
||||
Sound.Stop();
|
||||
if (obj.Type == ObjectType.Projectile) return;
|
||||
if (obj.Type == ObjectType.Player)
|
||||
{
|
||||
var player = (Player)obj;
|
||||
if (player.Vacuuming)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.TakeDamage(25);
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user