Example #1
0
        public Player(BattleShipsGame controller)
        {
            _game       = controller;
            _playerGrid = new SeaGrid(_Ships);
            // for each ship add the ships 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));
                }
            }

            this.RandomizeDeployment();
        }
Example #2
0
        public Player(BattleShipsGame controller)
        {
            // VBConversions Note: Non-static class variable initialization is below.  Class variables cannot be initially assigned non-static values in C#.
            _playerGrid = new SeaGrid(_Ships);

            _game = controller;

            //for each ship add the ships 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();
        }
Example #3
0
 // '' <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);
 }
Example #4
0
 private void InitializeInstanceFields()
 {
     _Ships      = new Dictionary <ShipName, Ship>();
     _playerGrid = new SeaGrid(_Ships);
 }
Example #5
0
 private void InitInstance()
 {
     _playerGrid = new SeaGrid(_Ships);
 }