diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 5064af0..76ca567 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites/Radar.cs b/EvilSatellites/Radar.cs index fbe9b7e..77edaef 100644 --- a/EvilSatellites/Radar.cs +++ b/EvilSatellites/Radar.cs @@ -49,7 +49,7 @@ namespace EvilSatellites public void Update(List objects) { if (objects.Count < 1) return; - float minDistance = 1000; + float minDistance = 50000000; Target = null; foreach (var obj in objects) { diff --git a/EvilSatellites/SatelliteSpawner.cs b/EvilSatellites/SatelliteSpawner.cs new file mode 100644 index 0000000..d8fd901 --- /dev/null +++ b/EvilSatellites/SatelliteSpawner.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using EvilSatellites.Objects; +using EvilSatellites.Screens; + +namespace EvilSatellites +{ + public class SatelliteSpawner + { + public GameScreen Screen; + private Random rnd = new Random(); + private int Level; + public SatelliteSpawner(GameScreen screen) + { + Screen = screen; + Level = 1; + } + + public void Spawn() + { + for (var i = 0; i < Level*20; i++) + { + var player = Screen.Objects.Where((x) => x.Type == ObjectType.Player).FirstOrDefault(); + var x = player.Position.X-250f + (float)rnd.NextDouble() * 500; + var y = player.Position.Y - 250f + (float)rnd.NextDouble() * 500; + var z = player.Position.Z - 250f + (float)rnd.NextDouble() * 500; + // DavyKager.Tolk.Speak("Spawning sat at " + x.ToString() + ", " + y.ToString() + ", " + z.ToString()); + var sat = new Satellite(Screen, new Vector3(x, y, z)); + Screen.AddObject(sat); + } + } + + public void Update() + { + + } + } +} diff --git a/EvilSatellites/Screens/GameScreen.cs b/EvilSatellites/Screens/GameScreen.cs index 5675a23..f62db19 100644 --- a/EvilSatellites/Screens/GameScreen.cs +++ b/EvilSatellites/Screens/GameScreen.cs @@ -23,15 +23,18 @@ namespace EvilSatellites.Screens private float Theta = 0; private Player _player; private Radar ObjectRadar; + private SatelliteSpawner Spawner; public void Activate() { State = ScreenState.Active; Player player = new Player(this); Objects.Add(player); _player = player; - Satellite prop = new Satellite(this, new Vector3(5000, 5000, 5000)); - Objects.Add(prop); + // Satellite prop = new Satellite(this, new Vector3(5000, 5000, 5000)); + // Objects.Add(prop); ObjectRadar = new Radar(_player, this); + Spawner = new SatelliteSpawner(this); + Spawner.Spawn(); return; } @@ -83,7 +86,7 @@ namespace EvilSatellites.Screens private void UpdateRadar() { var candidates = objtree.Find(_player.Position, new Vector3(1000, 1000, 1000)); - ObjectRadar.Update(candidates); + ObjectRadar.Update(Objects); } public void HandleInput(GameTime gameTime, KeyboardState inputs) @@ -176,6 +179,11 @@ namespace EvilSatellites.Screens Tolk.Output("Satellites"); } } + + if (Input.IsJustPressed(Keys.O)) + { + DavyKager.Tolk.Output(Objects.Count.ToString()); + } } private void CheckCollisions()