// Summary: Constructor for the Player // Parameter: controller - The game that the player is playing in public Player(BattleShipsGame controller) { _game = controller; _playerGrid = new SeaGrid(_ships); // for each ship, add the ship's name so the seagrid knows about them foreach (ShipName name in Enum.GetValues(typeof(ShipName))) { if (name != ShipName.None) { _ships.Add(name, new Ship(name)); } } RandomizeDeployment(); }
/* * Summary: Create the SeaGridAdapter, with the grid, and it will allow it to be changed * Parameter: grid: the grid that needs to be adapted */ public SeaGridAdapter(SeaGrid grid) { _myGrid = grid; _myGrid.Changed += new EventHandler(MyGrid_Changed); }
/// <summary> /// Create the SeaGridAdapter, with the grid, and it will allow it to be changed /// </summary> /// <param name="grid">the grid that needs to be adapted</param> public SeaGridAdapter(SeaGrid grid) { _MyGrid = grid; _MyGrid.Changed += new EventHandler(MyGrid_Changed); }