Exemple #1
0
 public void GetNthGenome(int n, out double[] values, out double fitness)
 {
     if (n < 0 || n > m_populationSize - 1)
     {
         throw new ArgumentOutOfRangeException("n too large, or too small");
     }
     project.Player g = ((Player)m_thisGeneration[n]);
     values = new double[g.Length];
     g.GetValues(ref values);
     fitness = (double)g.Fitness;
 }
 private void GameSetUp()
 {
     lives = 3;
     ship = new Ship(Content, graphics);
     playerCnt = 1;
     shift = new Vector2(0, 0);
     player = new Player(new Vector2(ship.GetPosition().X, ship.GetPosition().Y - 100), Content, 1);
     bluePlanet = new Planet(Content);
     gasPlanet = new Planet(Content, 1);
     aquaGasPlanet = new Planet(Content, 2);
     marblePlanet = new Planet(Content, 3);
     ps.Add(bluePlanet);
     ps.Add(gasPlanet);
     ps.Add(aquaGasPlanet);
     ps.Add(marblePlanet);
     ees.Clear();
     ecs.Clear();
     ets.Clear();
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), -1800, -400, marblePlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), -1700, 100, marblePlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), -1800, -50, marblePlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), -1650, 280, marblePlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), -1450, 500, marblePlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), -1820, 450, marblePlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 3600, 1800, aquaGasPlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 3000, 1800, aquaGasPlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 3600, 1500, aquaGasPlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 2500, -400, gasPlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 2300, -500, gasPlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 2000, -600, gasPlanet));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 2500, -700, gasPlanet));
     ets.Add(new EnemyTeleport(Content, new Vector2(1900, 950)));
     ets.Add(new EnemyTeleport(Content, new Vector2(1900, 950)));
     //ets.Add(new EnemyTeleport(Content, new Vector2(1900, 950)));
 }
 private void GameSetUp(int playerAmnt)
 {
     ship = new Ship(Content, graphics);
     player = new Player(new Vector2(ship.GetPosition().X, ship.GetPosition().Y - 100), Content, 1);
     playerCnt = playerAmnt;
     if(playerAmnt > 1)
         player2 = new Player(new Vector2(ship.GetPosition().X-70, ship.GetPosition().Y - 110), Content, 2);
     ees.Clear();
     ecs.Clear();
     ets.Clear();
     //ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 20, 30));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 800, 30));
     ecs.Add(new EnemyChaser(Content, new Vector2(1900, 950)));
     ets.Add(new EnemyTeleport(Content, new Vector2(1900, 950)));
 }
 private void GameSetUp()
 {
     lives = 3;
     ship = new Ship(Content, graphics);
     playerCnt = 1;
     player = new Player(new Vector2(ship.GetPosition().X, ship.GetPosition().Y - 100), Content, 1);
     ees.Clear();
     ecs.Clear();
     ets.Clear();
     //ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 20, 30));
     ees.Add(new EnemyEvader(Content, new Vector2(1900, 950), 800, 30));
     ecs.Add(new EnemyChaser(Content, new Vector2(1900, 950)));
     ecs.Add(new EnemyChaser(Content, new Vector2(1900, 950)));
     ecs.Add(new EnemyChaser(Content, new Vector2(1900, 950)));
     ecs.Add(new EnemyChaser(Content, new Vector2(1900, 950)));
     ets.Add(new EnemyTeleport(Content, new Vector2(1900, 950)));
 }
 public void MoveUp(Player player, Player player2, float elapsed)
 {
     if (position.Y > -950 + shipRing.Height / 2)
     {
         position.Y -= speed;
         controlConsole.Update(0, -speed);
         laserConsole.Update(0, -speed);
         teleportConsole.Update(0, -speed);
         turret.Update(0, -speed, elapsed);
         laser.Update(0, -speed);
         player.position.Y -= speed;
         player2.position.Y -= speed;
         shipKernel.UpdatePosition(position);
         shield.Update(0, -speed);
     }
 }
 public void MoveRight(Player player, Player player2, float elapsed)
 {
     if (position.X < screenSize.X - shipRing.Width / 2)
     {
         position.X += speed;
         player.position.X += speed;
         player2.position.X += speed;
         controlConsole.Update(speed, 0);
         teleportConsole.Update(speed, 0);
         laserConsole.Update(speed, 0);
         turret.Update(speed, 0, elapsed);
         laser.Update(speed, 0);
         shipKernel.UpdatePosition(position);
         shield.Update(speed, 0);
     }
 }
 public void MoveLeft(Player player, Player player2, float elapsed)
 {
     if (position.X > 0 + shipRing.Width / 2)
     {
         position.X -= speed;
         player.position.X -= speed;
         player2.position.X -= speed;
         controlConsole.Update(-speed, 0);
         laserConsole.Update(-speed, 0);
         teleportConsole.Update(-speed, 0);
         turret.Update(-speed, 0, elapsed);
         laser.Update(-speed, 0);
         shipKernel.UpdatePosition(position);
         shield.Update(-speed, 0);
     }
 }
 public void MoveDown(Player player, Player player2, float elapsed)
 {
     if (position.Y < screenSize.Y - shipRing.Height / 2)
     {
         position.Y += speed;
         controlConsole.Update(0, speed);
         laserConsole.Update(0, speed);
         teleportConsole.Update(0, speed);
         turret.Update(0, speed, elapsed);
         laser.Update(0, speed);
         player.position.Y += speed;
         player2.position.Y += speed;
         shipKernel.UpdatePosition(position);
         shield.Update(0, speed);
     }
 }
 private void GameSetUp()
 {
     ship = new Ship(Content, new Vector2(1900, 950));
     player = new Player(new Vector2(ship.GetPosition().X, ship.GetPosition().Y + ship.GetHeight()), Content);
 }