Пример #1
0
        internal bool AttackOn(Computer computer, Point p)
        {
            SeaTile tile = this[p.X, p.Y];

            if (tile.HasShipPart() && tile.ShipPart.ShipPartStatus == ShipPartStatuses.LIVE)
            {
                tile.ShipPart.Destroy();
                tile.SeaTileControl.DestroyCover();

                if (tile.ShipPart.Parent.AllPartsDestroyed())
                {
                    computer.Score         += 100;
                    Game.ComputerScore.Text = computer.Score.ToString();
                    computer.Ships         += 1;
                    Game.ComputerScore.Text = computer.Ships.ToString();
                    if (Game.ShipsManager.AllShipsAreDead())
                    {
                        Game.WhoWin();
                    }
                }
                else
                {
                    computer.Score         += 10;
                    Game.ComputerScore.Text = computer.Score.ToString();
                }
                return(true);
            }
            else
            {
                tile.SeaTileControl.DestroyCover();
                return(false);
            }
        }
Пример #2
0
 internal void CreateSea()
 {
     for (int x = 0; x < SeaWidth; x++)
     {
         for (int y = 0; y < SeaHeight; y++)
         {
             this[x, y] = new SeaTile(x, y);
         }
     }
 }