diff --git a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 index ad0b3ac..58e9600 100644 Binary files a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 and b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 7e839a0..c07cd40 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites/AudioAsset.cs b/EvilSatellites/AudioAsset.cs index c9961a7..26c7d8e 100644 --- a/EvilSatellites/AudioAsset.cs +++ b/EvilSatellites/AudioAsset.cs @@ -66,5 +66,10 @@ namespace EvilSatellites sound.Destroy(); } } + + public void Destroy() + { + Dispose(); + } } } diff --git a/EvilSatellites/AudioAsset3D.cs b/EvilSatellites/AudioAsset3D.cs index 3a2939a..89b8730 100644 --- a/EvilSatellites/AudioAsset3D.cs +++ b/EvilSatellites/AudioAsset3D.cs @@ -81,5 +81,10 @@ namespace EvilSatellites sound.Destroy(); } } + + public void Destroy() + { + Dispose(); + } } } diff --git a/EvilSatellites/Objects/Player.cs b/EvilSatellites/Objects/Player.cs index a1bba33..10976e6 100644 --- a/EvilSatellites/Objects/Player.cs +++ b/EvilSatellites/Objects/Player.cs @@ -68,6 +68,13 @@ namespace EvilSatellites.Objects public override void Destroy() { + sfxEngine.Destroy(); + sfxWhine.Destroy(); + sfxVacuum.Destroy(); + sfxTurn.Destroy(); + sfxTaps.Destroy(); + sfxElevator.Destroy(); + sfxDamage.Destroy(); return; } override public void Update(GameTime gameTime) diff --git a/EvilSatellites/Objects/Satellite.cs b/EvilSatellites/Objects/Satellite.cs index c28b578..1c77cf0 100644 --- a/EvilSatellites/Objects/Satellite.cs +++ b/EvilSatellites/Objects/Satellite.cs @@ -50,18 +50,17 @@ namespace EvilSatellites.Objects { 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); - if (rnd.Next(500) == 250) + if (rnd.Next(512) == 250) { var scr = (GameScreen)Screen; var player = scr.GetPlayer(); - var view = player.Position - Position; - var rotationAxis = Vector3.Cross(Rotation.Forward, view); - var rotationAngle = (float)Math.Acos(Vector3.Dot(Rotation.Forward, view) / Rotation.Forward.Length() / view.Length()); - var rotationMatrix = Matrix.CreateFromAxisAngle(rotationAxis, rotationAngle); - var proj = new Projectile(Screen, Position, rotationMatrix, this); - proj.Direction = new Vector3(0, 0, 1); + var orient = Matrix.Invert(Matrix.CreateTranslation(Position) * Matrix.CreateLookAt(Position, scr.GetPlayer().Position, Rotation.Up)); + var dir = Position - player.Position; + dir.Normalize(); + + var proj = new Projectile(Screen, Position, orient, this); + // proj.Direction = dir; scr.AddObject(proj); - DavyKager.Tolk.Output("Shoot!"); } } diff --git a/EvilSatellites/SatelliteSpawner.cs b/EvilSatellites/SatelliteSpawner.cs index 584e9fd..82c4a50 100644 --- a/EvilSatellites/SatelliteSpawner.cs +++ b/EvilSatellites/SatelliteSpawner.cs @@ -22,7 +22,7 @@ namespace EvilSatellites 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 x = player.Position.X-250f + (float)rnd.NextDouble() * 500; diff --git a/EvilSatellites/SoundPatch.cs b/EvilSatellites/SoundPatch.cs index 015e0c1..55aa35c 100644 --- a/EvilSatellites/SoundPatch.cs +++ b/EvilSatellites/SoundPatch.cs @@ -60,5 +60,12 @@ namespace EvilSatellites sndStop.Reset(); sndStop.Play(); } + + public void Destroy() + { + sndLoop.Destroy(); + sndStart.Destroy(); + sndStop.Destroy(); + } } }