// '' <summary> // '' Starts a new game. // '' </summary> // '' <remarks> // '' Creates an AI player based upon the _aiSetting. // '' </remarks> public static void StartGame() { if (_theGame) { IsNot; null; GameController.EndGame(); // Create the game _theGame = new BattleShipsGame(); // create the players switch (_aiSetting) { case AIOption.Medium: _ai = new AIMediumPlayer(_theGame); break; case AIOption.Hard: _ai = new AIHardPlayer(_theGame); break; default: _ai = new AIHardPlayer(_theGame); break; } _human = new Player(_theGame); // AddHandler _human.PlayerGrid.Changed, AddressOf GridChanged _ai.PlayerGrid.Changed += new System.EventHandler(this.GridChanged); _theGame.AttackCompleted += new System.EventHandler(this.AttackCompleted); GameController.AddNewState(GameState.Deploying); } // '' <summary> // '' Stops listening to the old game once a new game is started // '' </summary> }