private static TimeSpan Perform(bool smooth1, bool smooth2, bool color) { DiffDraw.Clear(0, 0); Renderer.Player.Clear(); Pixel[,] init = new Pixel[1, 2]; init.Populate(new Pixel()); DiffDraw.Clear(init); DiffDraw.Draw(false, true); Stopwatch t = Stopwatch.StartNew(); (char[,] level, _) = CharArrayLoader.LoadLevel(@" ##################### # ### # ### # # # ## # # # # # ## # #####################", smooth1); DiffDraw.Clear(ColorSelector.Get(level)); Renderer.Player.Add(new Tuple <Point, Point>(new Point(1, 2), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(2, 2), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(2, 3), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(1, 3), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(1, 4), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(1, 5), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(1, 6), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(2, 6), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(2, 5), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(2, 4), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(3, 4), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(3, 3), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(3, 2), new Point(0, 0))); Renderer.Player.Add(new Tuple <Point, Point>(new Point(4, 2), new Point(0, 0))); Renderer.Enemies.Add(new Point(5, 4)); Renderer.Enemies.Add(new Point(5, 5)); Renderer.Enemies.Add(new Point(5, 6)); Renderer.Enemies.Add(new Point(6, 6)); Renderer.Enemies.Add(new Point(7, 6)); Renderer.Enemies.Add(new Point(7, 5)); Renderer.Enemies.Add(new Point(7, 4)); Renderer.Enemies.Add(new Point(6, 3)); Renderer.Enemies.Add(new Point(5, 2)); Renderer.Render(smooth2); DiffDraw.Draw(color); foreach (string t1 in Levels.levels) { (char[,] lvl, _) = CharArrayLoader.LoadLevel(t1, SettingsMan.SmoothTerrain); DiffDraw.Clear(ColorSelector.Get(lvl)); DiffDraw.Draw(true); } t.Stop(); return(t.Elapsed); }
private static void PlayRound() { Console.Clear(); bool playing = true; Pixel[,] init = new Pixel[1, 2]; init.Populate(new Pixel()); DiffDraw.Clear(init); DiffDraw.Draw(false); Label scoreLabel = new Label(new Point(0, 0), ""); Renderer.Labels.Clear(); Renderer.Labels.Add(scoreLabel); Levels.Load(); (char[,] level, bool[,] spawnable) = CharArrayLoader.LoadLevel(Levels.levels[Rnd.Next(Levels.levels.Length)], SettingsMan.SmoothTerrain); bool hasIncreased = false; Renderer.Player.Clear(); Renderer.Player.Add(new Tuple <Point, Point>(new Point(1, 1), new Point(0, 1))); Renderer.Enemies.Clear(); DiffDraw.Clear(ColorSelector.Get(level)); DiffDraw.Draw(SettingsMan.Color); Input.Reset(); while (playing) { DiffDraw.Clear(ColorSelector.Get(level)); scoreLabel.Text = $"Score: {_score}"; Renderer.Render(SettingsMan.SmoothPlayer); Input.Get(); if (Input.Move(hasIncreased) || Input.Esc) { Renderer.Player.Clear(); Input.Reset(); playing = false; Input.Esc = false; continue; } if (Input.R) { _score = 0; init.Populate(new Pixel()); DiffDraw.Clear(init); DiffDraw.Draw(SettingsMan.Color); Console.Clear(); (level, spawnable) = CharArrayLoader.LoadLevel(Levels.levels[Rnd.Next(Levels.levels.Length)], SettingsMan.SmoothTerrain); DiffDraw.Clear(ColorSelector.Get(level)); Renderer.Player.Clear(); Renderer.Player.Add(new Tuple <Point, Point>(new Point(2, 2), new Point(0, 1))); Renderer.Enemies.Clear(); Input.Reset(); Input.R = false; } Renderer.Render(SettingsMan.SmoothPlayer); hasIncreased = Enemy.Compute(spawnable); if (hasIncreased) { _score++; } DiffDraw.Draw(SettingsMan.Color); } Console.ResetColor(); }