public void Update() { LaserFactory laserFactory = new LaserFactory(laserSpeed, laserWidth, laserHeight, numRows * numColumns); BombFactory bombFactory = new BombFactory(bombSpeed, bombWidth, bombHeight, numBombSlots); ScoreAndLife scoreAndLife = new ScoreAndLife(lives, laserFactory, bombFactory); Player player = new Player(screenWidth, screenHeight, playerSpeed, playerWidth, playerHeight, laserFactory, bombFactory, scoreAndLife, timerIntervalPlayerRespawn); Bunkers bunkers = new Bunkers(numBunkers, screenWidth, screenHeight, bunkerWidth, bunkerHeight, bunkerHealth, playerHeight, spaceBetweenBunkerAndPlayer); Mothership mothership = new Mothership(screenWidth, mothershipWidth, mothershipHeight, mothershipSpeed, mothershipPoints, timerIntervalMothership, mothershipSpacerFromTop); //int screenWidth = 100; //int alienWidth = 1; //int alienHeight = 2; //int alienSpeed = 1; //int spacer = 1; //int numRows = 1; //int rowLength = 1; //int playerHeight = 0; //arrange //Bunkers bunkers = new Bunkers(numBunkers, screenWidth, screenHeight, bunkerWidth, bunkerHeight, bunkerHealth, playerHeight, spaceBetweenBunkerAndPlayer); BombFactory bf = new BombFactory(0, 0, 0, 0); AlienSquad alienS = new AlienSquad(bunkers, bombFactory, laserFactory, player, mothership, scoreAndLife, numRows, numColumns, screenWidth, player.BoundingBox.Height, alienWidth, alienHeight, alienSpeed, spacer, bombFrequency, alienPointStart, alienPointDecrement, alienSpacerFromTop, speedIncrease, bombFrequencyIncrement, bombFrequencyMin); //act alienS.Update(); //assert //Assert.AreEqual(,); //expected, actual }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } if (player.Alive) { laserFactory.UpdateProjectiles(); bombFactory.UpdateProjectiles(); alienSquad.Update(); } base.Update(gameTime); }