public void Try_InRange() { Arena arena = new Arena(); Team team = arena.CreateTeam("red"); Goblin Pal = new Goblin(arena, team, 1); Pal.Location = new Vector(0, 0); Goblin target = new Goblin(arena, team, 1); Random rdm = new Random(); double x; double y; for (int i = 0; i < 42; i++) { x = rdm.NextDouble() * 2 - 1; y = rdm.NextDouble() * 2 - 1; target.Location = new Vector(x, y); Pal.Target = target; Pal.NewDirection(); } }
public void Try_New_Direction() { Arena arena = new Arena(); Team team = arena.CreateTeam("red"); Goblin Pal = new Goblin(arena, team, 1); Random rdm1 = new Random(); double x = rdm1.NextDouble() * 2 - 1; double y = rdm1.NextDouble() * 2 - 1; Pal.Location = new Vector(x, y); Goblin target = new Goblin(arena, team, 1); double x2 = rdm1.NextDouble() * 2 - 1; double y2 = rdm1.NextDouble() * 2 - 1; target.Location = new Vector(x2, y2); Pal.Target = target; Pal.NewDirection(); Assert.That(Pal.Direction, Is.EqualTo(new Vector(x2 - x, y2 - y))); }