diff --git a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 index 796ccc9..ad0b3ac 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 44c37e2..ca4f388 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites/Objects/Debris.cs b/EvilSatellites/Objects/Debris.cs index f2978d3..b1dfb66 100644 --- a/EvilSatellites/Objects/Debris.cs +++ b/EvilSatellites/Objects/Debris.cs @@ -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(); + } } } } diff --git a/EvilSatellites/Objects/ObjectType.cs b/EvilSatellites/Objects/ObjectType.cs index 60cdd4b..95d4195 100644 --- a/EvilSatellites/Objects/ObjectType.cs +++ b/EvilSatellites/Objects/ObjectType.cs @@ -9,6 +9,7 @@ namespace EvilSatellites.Objects Generic, Player, Satellite, - Projectile + Projectile, + Debris } } diff --git a/EvilSatellites/Objects/Player.cs b/EvilSatellites/Objects/Player.cs index a69f5e4..3a270b5 100644 --- a/EvilSatellites/Objects/Player.cs +++ b/EvilSatellites/Objects/Player.cs @@ -12,7 +12,7 @@ namespace EvilSatellites.Objects { private Vector3 _PrevPos; private Vector3 MaxSpeed = new Vector3(0.2f, 0.2f, 0.2f); - public Vector3 Acceleration = new Vector3(0.008f, 0.008f, 0.008f); + public Vector3 Acceleration = new Vector3(0.002wf, 0.004f, 0.004f); private Vector3 Deceleration = new Vector3(0.0025f, 0.0025f, 0.0025f); private ISoundEffect sfxEngine; private ISoundEffect sfxWhine; @@ -22,18 +22,24 @@ namespace EvilSatellites.Objects public IWeapon CurrentWeapon; private int Turning; private int Elevating; + public bool Vacuuming; + public float Health; + private Random rnd = new Random(); public Player(IScreen screen): base(screen) { ShouldDestroy = false; Active = true; Type = ObjectType.Player; - Position = new Vector3(0, 0, 0); + Position = new Vector3(5000, 5000, 4990); Dimensions = new Vector3(5, 5, 5); Movement = new Vector3(0, 0, 0); Rotation = Matrix.Identity; Orientation = Rotation.Forward; CurrentWeapon = new LaserMG(this, (GameScreen)Screen); Turning = 0; + Elevating = 0; + Vacuuming = false; + Health = 100; Activate(); } @@ -144,5 +150,35 @@ namespace EvilSatellites.Objects Elevating = 0; sfxElevator.Stop(); } + + public void StartVacuuming(GameTime time) + { + Vacuuming = true; + sfxVacuum.Start(time); + } + + public void StopVacuuming() + { + Vacuuming = false; + sfxVacuum.Stop(); + } + + public void TakeDamage(float dmg) + { + Health -= dmg; + string dmgSound = @"sfx/physics/collisions/"; + if (dmg > 60) + { + dmgSound += "heavy"; + } else if (dmg > 30) + { + dmgSound += "medium"; + } else + { + dmgSound += "light"; + } + dmgSound += "/int/" + (rnd.Next(2)+1).ToString()+".wav"; + Screen.Manager.Sound.PlayOneshot(dmgSound); + } } } diff --git a/EvilSatellites/Objects/Projectile.cs b/EvilSatellites/Objects/Projectile.cs index 7b389d6..7ee95e8 100644 --- a/EvilSatellites/Objects/Projectile.cs +++ b/EvilSatellites/Objects/Projectile.cs @@ -32,9 +32,16 @@ namespace EvilSatellites.Objects { ShouldDestroy = false; Active = true; + Sound = Screen.Manager.Sound.Load3D(@"sfx/bullets/1.wav"); + Sound.Loop = true; + Sound.Play(); + Sound.Pitch = 0.9 + rnd.NextDouble()*0.3; + Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2); } public override void Destroy() { + Sound.Stop(); + Sound.Destroy(); ShouldDestroy = true; Active = false; } @@ -46,13 +53,13 @@ namespace EvilSatellites.Objects { Destroy(); } + 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) { - if (obj.Type == ObjectType.Projectile) return; - if (obj.Type == ObjectType.Player) return; - Screen.Manager.Sound.PlayOneshot(@"sfx/physics/impacts/bullet/"+(rnd.Next(5)+1)+".wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z), Screen.Manager.EnvironmentEffect); + if (obj.Type == ObjectType.Projectile || obj.Type == ObjectType.Player || obj.Type == ObjectType.Debris) return; + Screen.Manager.Sound.PlayOneshot(@"sfx/physics/impacts/bullet/"+(rnd.Next(5)+1)+".wav", new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2), Screen.Manager.EnvironmentEffect); Destroy(); } } diff --git a/EvilSatellites/Objects/Satellite.cs b/EvilSatellites/Objects/Satellite.cs index 79e6d71..5e390ae 100644 --- a/EvilSatellites/Objects/Satellite.cs +++ b/EvilSatellites/Objects/Satellite.cs @@ -15,16 +15,20 @@ namespace EvilSatellites.Objects private int Health; private int SatelliteID; private Random rnd = new Random(); + private Matrix FlightPath; public Satellite(IScreen screen, Vector3 pos, int satelliteID = 1) : base(screen) { Type = ObjectType.Satellite; SatelliteID = satelliteID; Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/"+SatelliteID.ToString()+"/loop.wav"); Sound.Loop = true; + Sound.Pitch = 0.9 + rnd.NextDouble()*0.5; Position = pos; Dimensions = new Vector3(5, 5, 5); Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z); Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect); + FlightPath = Matrix.CreateFromAxisAngle(Rotation.Right, (float)rnd.NextDouble()*0.1f); + Rotation = FlightPath; Activate(); } @@ -44,12 +48,19 @@ namespace EvilSatellites.Objects override public void Update(GameTime gameTime) { - Sound.Position = new System.Numerics.Vector3(Position.X, Position.Y, Position.Z); + 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); } public override void OnCollision(IGameObject obj) { Health -= 10; + if (obj.Type == ObjectType.Player) + { + var player = (Player)obj; + player.TakeDamage(66); + Destroy(); + } if (Health <= 0) { Screen.Manager.Sound.PlayOneshot(@"sfx/satellite/"+SatelliteID.ToString()+"/explode.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z)); diff --git a/EvilSatellites/Radar.cs b/EvilSatellites/Radar.cs index 343247d..fbe9b7e 100644 --- a/EvilSatellites/Radar.cs +++ b/EvilSatellites/Radar.cs @@ -17,15 +17,22 @@ namespace EvilSatellites public IGameObject Target; public IScreen Screen; public ISoundEffect RadarNoise; + public ObjectType Filter; public Radar(IGameObject owner, IScreen screen) { Owner = owner; Screen = screen; RadarNoise = Screen.Manager.Sound.Load(@"sfx/ui/radar/pingEnemy.wav", false); RadarNoise.Loop = true; + Filter = ObjectType.Satellite; Active = false; } + public void SetObjectType(ObjectType type) + { + Filter = type; + } + public void Start() { RadarNoise.Reset(); @@ -43,9 +50,10 @@ namespace EvilSatellites { if (objects.Count < 1) return; float minDistance = 1000; + Target = null; foreach (var obj in objects) { - if (obj.Type != ObjectType.Satellite) continue; + if (obj.Type != Filter) continue; float distance = Vector3.Distance(obj.Position, Owner.Position); if (distance < minDistance) { @@ -53,7 +61,11 @@ namespace EvilSatellites Target = obj; } } - if (Target == null) return; + if (Target == null) + { + RadarNoise.Pitch = 0.1; + return; + } Vector3 radarTarget = (Target.Position - Owner.Position); radarTarget.Normalize(); RadarNoise.Pitch = MathHelper.Clamp(0.1f / Vector3.Distance(Owner.Rotation.Forward, radarTarget) * 3f, 0, 1); diff --git a/EvilSatellites/Screens/GameScreen.cs b/EvilSatellites/Screens/GameScreen.cs index 23e3311..bf69667 100644 --- a/EvilSatellites/Screens/GameScreen.cs +++ b/EvilSatellites/Screens/GameScreen.cs @@ -29,7 +29,7 @@ namespace EvilSatellites.Screens Player player = new Player(this); Objects.Add(player); _player = player; - Satellite prop = new Satellite(this, new Vector3(15, 0, 15)); + Satellite prop = new Satellite(this, new Vector3(5000, 5000, 5000)); Objects.Add(prop); ObjectRadar = new Radar(_player, this); return; @@ -63,7 +63,7 @@ namespace EvilSatellites.Screens objtree.Add(obj); if (obj.Type == ObjectType.Player) { - Manager.Sound.ListenerPosition = new System.Numerics.Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z); + Manager.Sound.ListenerPosition = new System.Numerics.Vector3(obj.Position.X+obj.Dimensions.X/2, obj.Position.Y+obj.Dimensions.Y/2, obj.Position.Z+obj.Dimensions.Z/2); Manager.Sound.ListenerOrientationForward = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Forward.X, obj.Rotation.Forward.Y, obj.Rotation.Forward.Z)); Manager.Sound.ListenerOrientationUpwards = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Up.X, obj.Rotation.Up.Y, obj.Rotation.Up.Z)); Manager.Listener.Position = obj.Position; @@ -130,6 +130,14 @@ namespace EvilSatellites.Screens { _player.StopElevating(); } + if (Input.IsJustPressed(Keys.V)) + { + _player.StartVacuuming(gameTime); + } + if (Input.IsJustReleased(Keys.V)) + { + _player.StopVacuuming(); + } _player.Accelerate(move); if (Input.IsJustPressed(Keys.Space)) { @@ -139,14 +147,6 @@ namespace EvilSatellites.Screens { _player.CurrentWeapon.Stop(); } - if (Input.IsJustPressed(Keys.V)) - { - Tolk.Speak(_player.Movement.Length().ToString(), true); - } - if (Input.IsJustPressed(Keys.C)) - { - Tolk.Speak(_player.Position.ToString()); - } if (Input.IsJustPressed(Keys.R)) { if (ObjectRadar.Active) @@ -157,9 +157,17 @@ namespace EvilSatellites.Screens ObjectRadar.Start(); } } - if (Input.IsJustPressed(Keys.O)) + if (Input.IsJustPressed(Keys.T)) { - Tolk.Speak(Objects.Count.ToString()); + if (ObjectRadar.Filter == ObjectType.Satellite) + { + ObjectRadar.SetObjectType(ObjectType.Debris); + Tolk.Output("Debris"); + } else + { + ObjectRadar.SetObjectType(ObjectType.Satellite); + Tolk.Output("Satellites"); + } } } diff --git a/EvilSatellites/sfx/bullets/1.wav b/EvilSatellites/sfx/bullets/1.wav new file mode 100644 index 0000000..2ba59d7 --- /dev/null +++ b/EvilSatellites/sfx/bullets/1.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81c7340107f82cee2d8f968a94f40be9c326b820d87c1216368979216bbc2ab6 +size 269864