/// <summary> /// Initializes a new instance of the <see cref="GameManager" /> class. /// Precondition: backgroundHeight > 0 AND backgroundWidth > 0 /// </summary> /// <param name="backgroundHeight">The backgroundHeight of the game play window.</param> /// <param name="backgroundWidth">The backgroundWidth of the game play window.</param> public GameManager(double backgroundHeight, double backgroundWidth) { if (backgroundHeight <= 0) { throw new ArgumentOutOfRangeException(nameof(backgroundHeight)); } if (backgroundWidth <= 0) { throw new ArgumentOutOfRangeException(nameof(backgroundWidth)); } this.currentLevel = 1; this.backgroundHeight = backgroundHeight; this.backgroundWidth = backgroundWidth; this.initializePlayerShipFactory(); this.fleet = new EnemyFleet(4); this.initializeDataMembers(); this.enemyMotionCounter = 0; this.initializeTimer(); }
private void goToNextRound() { this.resetCanvas(); this.initializePlayerShipFactory(); this.fleet = new EnemyFleet(this.fleet.Levels + 1); this.initializeDataMembers(); this.enemyMotionCounter = 0; this.initializeTimer(); this.InitializeGame(this.currentBackground); }