コード例 #1
0
ファイル: Battlefiel.cs プロジェクト: EugeneMurashko/git-test
 public Battlefiel()
 {
     for (int i = 0; i < 10; i++)
         for (int j = 0; j < 10; j++)
         {
             squareArr[i, j] = new Square();
             squareArr[i, j].x = i;
             squareArr[i, j].y = j;
         }
 }
コード例 #2
0
ファイル: Ship.cs プロジェクト: EugeneMurashko/git-test
        public Ship(NumShip ship, Direction direction, Square coord)
        {
            square = coord;
            int length;
            if ((int)ship == 1)
            {
                length = 4;
                hitpoint = 4;
            }
            else if ((int)ship > 1 && (int)ship <= 3)
            {
                length = 3;
                hitpoint = 3;
            }
            else if ((int)ship > 3 && (int)ship <= 6)
            {
                length = 2;
                hitpoint = 2;
            }
            else if ((int)ship > 6 && (int)ship <= 10)
            {
                length = 1;
                hitpoint = 1;
            }
            else
            {
                length = 0;
                hitpoint = 0;
            }

            for(int i = 0; i < length; i++)
            {
                Square s = new Square(coord.nship, coord.state, coord.x, coord.y);
                s.Move(i, direction);
                coordinateslist.Add(s);
            }
        }
コード例 #3
0
ファイル: Battlefiel.cs プロジェクト: EugeneMurashko/git-test
 public void Clear()
 {
     for (int i = 0; i < 10; i++)
         for (int j = 0; j < 10; j++)
         {
             squareArr[i, j] = new Square();
             squareArr[i, j].x = i;
             squareArr[i, j].y = j;
         }
 }