public FruitBasketGame(List <Player> players, IFruitBasketConfig config) { Check.NotNull(players, nameof(players)); Check.NotNull(config, nameof(config)); _config = config; _players = players; if (_players.Count < _config.MinPlayersCount || _players.Count > _config.MaxPlayersCount) { throw new ArgumentException($"Number of players must be between {_config.MinPlayersCount} and {_config.MaxPlayersCount}"); } Secret = RandomInt.Next(_config.MinFruitBasketWeight, _config.MaxFruitBasketWeight); }
public void SendEmail(string to, string subject, string emailBody) { //Arrange int number = RandomInt.Next(0, 9999999); subject = $"{subject} {number}"; //Test Ui.InboxPage.LeftMenu.ClickComposeButton(); Ui.NewMessageDialog.FillToField(to); Ui.NewMessageDialog.FillSubject(subject); Ui.NewMessageDialog.FillBody(emailBody); Ui.NewMessageDialog.FillCc(Config.Email); Ui.NewMessageDialog.ClickSendButton(); //Asserts Assert.That(Ui.InboxPage.Grid.IsEmailExist(subject)); }
public static void Load() { for (int i = 0; i < Asteroid.asteroidCount; i++) { _asteroids.Add(new Asteroid( new Point(RandomInt.Next(Game.Width / 2, Game.Width), RandomInt.Next(0, Game.Height)), new Point(RandomInt.Next(1, 10), RandomInt.Next(1, 10)), new Size(RandomInt.Next(10, 50), RandomInt.Next(10, 50)))); } for (int i = 0; i < Star.starCount; i++) { _stars.Add(new Star( new Point(RandomInt.Next(0, Game.Width), RandomInt.Next(0, Game.Height)), new Point(RandomInt.Next(1, 10), 0), new Size(RandomInt.Next(50, 80), RandomInt.Next(60, 100)))); } _medpacks.Add(new Medpack( new Point(RandomInt.Next(Game.Width / 2, Game.Width), RandomInt.Next(20, Game.Height)), new Point(RandomInt.Next(1, 5), 0), new Size(30, 25))); }
public static void Update() { foreach (Star a in _stars) { a.Update(); } foreach (Bullet b in _bullets) { b.Update(); } foreach (Medpack c in _medpacks) { c.Update(); } var temp_b = new List <Bullet>(); var temp_a = new List <Asteroid>(); var temp_m = new List <Medpack>(); if (_asteroids.Count == 0) { Asteroid.asteroidCount++; for (int i = 0; i < Asteroid.asteroidCount; i++) { _asteroids.Add(new Asteroid( new Point(RandomInt.Next(Game.Width / 2, Game.Width), RandomInt.Next(0, Game.Height)), new Point(RandomInt.Next(1, 10), RandomInt.Next(1, 10)), new Size(RandomInt.Next(10, 50), RandomInt.Next(10, 50)))); } } if (_medpacks.Count == 0) { _medpacks.Add(new Medpack( new Point(RandomInt.Next(Game.Width / 2, Game.Width), RandomInt.Next(20, Game.Height)), new Point(RandomInt.Next(1, 5), 0), new Size(30, 25))); } foreach (var asteroid in _asteroids) { asteroid.Update(); foreach (var bullet in _bullets) { if (bullet.Collision(asteroid)) { System.Media.SystemSounds.Hand.Play(); temp_a.Add(asteroid); temp_b.Add(bullet); } } if (_ship.Collision(asteroid)) { _ship.EnergyLow(RandomInt.Next(1, 10)); System.Media.SystemSounds.Asterisk.Play(); temp_a.Add(asteroid); if (_ship.Energy <= 0) { _ship.Die(); } } } foreach (var medpack in _medpacks) { if (medpack.Collision(_ship)) { temp_m.Add(medpack); _ship.EnergyUp(RandomInt.Next(10, 30)); } } foreach (Bullet b in temp_b) { _bullets.Remove(b); } foreach (Asteroid a in temp_a) { _asteroids.Remove(a); } foreach (Medpack m in temp_m) { _medpacks.Remove(m); } }
protected virtual int NextGuess() { return(RandomInt.Next(Config.MinFruitBasketWeight, Config.MaxFruitBasketWeight)); }