private void Reset() { explosions.Clear(); diagonals.Clear(); drawer = new Drawer(); collision = new Collision(); //Set player's score to zero missileCount = 3; secondTimer = 60; difficultyFactor = 1.0f; projectiles.Clear(); missiles.Clear(); // Initialize the enemies list enemies.Clear(); // Initialize the health power up list healthPowerUps.Clear(); // Initialize the missile power up list missilePowerUps.Clear(); // Initialize the rapid fire power up list rapidFirePowerUps.Clear(); // Initialize the heavyEnemies list heavyEnemies.Clear(); //Reset fire time collision.fireTime = TimeSpan.FromSeconds(.15f); }
//============================================================================================================================ protected override void Initialize() { explosions = new List<Animation>(); diagonals = new List<Diagonal>(); state = gameState.startScreen; drawer = new Drawer(); collision = new Collision(); waveTimer = new WaveTimer(); //Initial values of variables score = 0; missileCount = 3; secondTimer = 60; difficultyFactor = 1.0f; transportShipHealth = 300; timePlayed = 0; projectiles = new List<Laser>(); missiles = new List<Missile>(); healthPowerUps = new List<HealthPowerUp>(); missilePowerUps = new List<MissilePowerUp>(); rapidFirePowerUps = new List<RapidFirePowerUp>(); transportHealTime = TimeSpan.FromSeconds(1.1); // Initialize the enemies list enemies = new List<Enemy>(); // Initialize the heavyEnemies list heavyEnemies = new List<HeavyEnemy>(); // Set the time keepers to zero waveTimer.previousEnemySpawnTime = TimeSpan.Zero; // Set the time keepers to zero previousHealthPowerUpSpawnTime = TimeSpan.Zero; previousMissilePowerUpSpawnTime = TimeSpan.Zero; previousRapidFirePowerUpSpawnTime = TimeSpan.Zero; //Used to determine how fast health power ups respawn healthPowerUpSpawnTime = TimeSpan.FromSeconds(12.5f); //Used to determine how fast health power ups respawn missilePowerUpSpawnTime = TimeSpan.FromSeconds(20.0f); //Used to determine how fast rapid fire power ups respawn rapidFirePowerUpSpawnTime = TimeSpan.FromSeconds(17.0f); // Initialize our random number generator random = new Random(); bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); // Initialize the player class player = new Player(); // Set a constant player move speed playerMoveSpeed = 12.0f; viewportHeight = GraphicsDevice.Viewport.Height; viewportWidth = GraphicsDevice.Viewport.Width; transportShip = new TransportShip(); transportShip.Initialize(viewportWidth,viewportHeight); playerCutscene = new PlayerCutscene(); playerCutscene.Initialize(viewportWidth, viewportHeight, GraphicsDevice.Viewport.TitleSafeArea.X, (GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2) - 34); base.Initialize(); }