//********************************************************************************************************************************************* // // Method Name: Destroyed // // Description: // When called on destruction of the brick, this method adds the hidden power up to the game power up list if the hidden power up exists. // // Arguments: // theBreakoutGame - The game object that tracks various game elements. // // Return: // N/A // //********************************************************************************************************************************************* public void Destroyed(BreakoutGame theBreakoutGame) { // Check to see if a power up was hidden in this brick, and add it to the power up list if so. if (mPowerUp != null) { theBreakoutGame.GetPowerUpList().Add(mPowerUp); } for (int count = 0; count < 30; count++) { // Determine a random location within the bricks. int theRandomXPosition = theBreakoutGame.RandomNumberGenerator.Next((int)HitBox.X, (int)(HitBox.X + HitBox.Width)); int theRandomYPosition = theBreakoutGame.RandomNumberGenerator.Next((int)HitBox.Y, (int)(HitBox.Y + HitBox.Height)); // Add a new particle for the brick explosion at the new random location that travels at a random velocity in any direction. theBreakoutGame.Particles.Add(new Particle(theRandomXPosition, theRandomYPosition, BreakoutConstants.BRICK_EXPLOSION_WIDTH_AND_LENGTH, BreakoutConstants.BRICK_EXPLOSION_MINIMUM_ANGLE, BreakoutConstants.BRICK_EXPLOSION_MAXIMUM_ANGLE, BreakoutConstants.BRICK_EXPLOSION_TIME_MILLISECONDS, Color.FromArgb(255, 34, 177, 76), theBreakoutGame)); } }
//********************************************************************************************************************************************* // // Method Name: DrawPowerUps // // Description: // TODO: Add description. // // Arguments: // theGraphics - TODO: Add description. // // Return: // N/A // //********************************************************************************************************************************************* public void DrawPowerUps(Graphics theGraphics) { foreach (PowerUp currentPowerUp in mBreakoutGame.GetPowerUpList()) { currentPowerUp.Draw(theGraphics); } }