예제 #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));
                }
            }

            RandomizeDeployment();
        }
예제 #2
0
        //COMMENT HERE
        public Player(BattleShipsGame controller)
        {
            _game       = controller;
            _playerGrid = new SeaGrid(_Ships);
            // for each ship add the ships name so the seagrid knows about them
            if (GameController.ShipsToDeploy == 3)
            {
                foreach (ShipName name in Enum.GetValues(typeof(ShipName)))
                {
                    if ((name != ShipName.None) && (name != ShipName.Tug) && (name != ShipName.Submarine))
                    {
                        _Ships.Add(name, new Ship(name));
                    }
                }
            }
            else if (GameController.ShipsToDeploy == 4)
            {
                foreach (ShipName name in Enum.GetValues(typeof(ShipName)))
                {
                    if ((name != ShipName.None) && (name != ShipName.Tug))
                    {
                        _Ships.Add(name, new Ship(name));
                    }
                }
            }
            else
            {
                foreach (ShipName name in Enum.GetValues(typeof(ShipName)))
                {
                    if ((name != ShipName.None))
                    {
                        _Ships.Add(name, new Ship(name));
                    }
                }
            }

            RandomizeDeployment();
        }
예제 #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);
 }
예제 #4
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);
 }