More shooting goodness

This commit is contained in:
2021-04-19 21:33:56 +02:00
parent c49db61494
commit 671ed50a33
8 changed files with 32 additions and 9 deletions
Binary file not shown.
Binary file not shown.
+5
View File
@@ -66,5 +66,10 @@ namespace EvilSatellites
sound.Destroy(); sound.Destroy();
} }
} }
public void Destroy()
{
Dispose();
}
} }
} }
+5
View File
@@ -81,5 +81,10 @@ namespace EvilSatellites
sound.Destroy(); sound.Destroy();
} }
} }
public void Destroy()
{
Dispose();
}
} }
} }
+7
View File
@@ -68,6 +68,13 @@ namespace EvilSatellites.Objects
public override void Destroy() public override void Destroy()
{ {
sfxEngine.Destroy();
sfxWhine.Destroy();
sfxVacuum.Destroy();
sfxTurn.Destroy();
sfxTaps.Destroy();
sfxElevator.Destroy();
sfxDamage.Destroy();
return; return;
} }
override public void Update(GameTime gameTime) override public void Update(GameTime gameTime)
+7 -8
View File
@@ -50,18 +50,17 @@ namespace EvilSatellites.Objects
{ {
Move(new Vector3(0, 0, -0.05f)); Move(new Vector3(0, 0, -0.05f));
Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2); Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2);
if (rnd.Next(500) == 250) if (rnd.Next(512) == 250)
{ {
var scr = (GameScreen)Screen; var scr = (GameScreen)Screen;
var player = scr.GetPlayer(); var player = scr.GetPlayer();
var view = player.Position - Position; var orient = Matrix.Invert(Matrix.CreateTranslation(Position) * Matrix.CreateLookAt(Position, scr.GetPlayer().Position, Rotation.Up));
var rotationAxis = Vector3.Cross(Rotation.Forward, view); var dir = Position - player.Position;
var rotationAngle = (float)Math.Acos(Vector3.Dot(Rotation.Forward, view) / Rotation.Forward.Length() / view.Length()); dir.Normalize();
var rotationMatrix = Matrix.CreateFromAxisAngle(rotationAxis, rotationAngle);
var proj = new Projectile(Screen, Position, rotationMatrix, this); var proj = new Projectile(Screen, Position, orient, this);
proj.Direction = new Vector3(0, 0, 1); // proj.Direction = dir;
scr.AddObject(proj); scr.AddObject(proj);
DavyKager.Tolk.Output("Shoot!");
} }
} }
+1 -1
View File
@@ -22,7 +22,7 @@ namespace EvilSatellites
public void Spawn() public void Spawn()
{ {
for (var i = 0; i < Level*1; i++) for (var i = 0; i < Level*2; i++)
{ {
var player = Screen.Objects.Where((x) => x.Type == ObjectType.Player).FirstOrDefault(); var player = Screen.Objects.Where((x) => x.Type == ObjectType.Player).FirstOrDefault();
var x = player.Position.X-250f + (float)rnd.NextDouble() * 500; var x = player.Position.X-250f + (float)rnd.NextDouble() * 500;
+7
View File
@@ -60,5 +60,12 @@ namespace EvilSatellites
sndStop.Reset(); sndStop.Reset();
sndStop.Play(); sndStop.Play();
} }
public void Destroy()
{
sndLoop.Destroy();
sndStart.Destroy();
sndStop.Destroy();
}
} }
} }