コード例 #1
0
ファイル: GameBoard.cs プロジェクト: kepo4ka/Diplom-CGC
 /// <summary>
 /// Задать команду
 /// </summary>
 /// <returns>Команда</returns>
 public virtual PlayerAction Play(GameBoard gb)
 {
     return(PlayerAction.Wait);
 }
コード例 #2
0
ファイル: GameBoard.cs プロジェクト: kepo4ka/Diplom-CGC
        public object Clone()
        {
            GameBoard nGameBoard = new GameBoard();

            nGameBoard = (GameBoard)MemberwiseClone();

            nGameBoard.Cells = new Cell[nGameBoard.W, nGameBoard.H];

            for (int i = 0; i < nGameBoard.Cells.GetLength(0); i++)
            {
                for (int j = 0; j < nGameBoard.Cells.GetLength(1); j++)
                {
                    nGameBoard.Cells[i, j]      = new Cell();
                    nGameBoard.Cells[i, j].X    = i;
                    nGameBoard.Cells[i, j].Y    = j;
                    nGameBoard.cells[i, j].Type = Cells[i, j].Type;
                }
            }

            nGameBoard.Bonuses = new List <Bonus>();

            for (int i = 0; i < Bonuses.Count; i++)
            {
                if (Bonuses[i].Visible == false)
                {
                    continue;
                }
                Bonus nbonus = new Bonus(Bonuses[i]);
                nGameBoard.Bonuses.Add(nbonus);
            }

            nGameBoard.Bombs = new List <Bomb>();

            for (int i = 0; i < Bombs.Count; i++)
            {
                Bomb nbomb = new Bomb(Bombs[i]);
                nGameBoard.Bombs.Add(nbomb);
            }

            nGameBoard.Lavas = new List <Lava>();

            for (int i = 0; i < Lavas.Count; i++)
            {
                Lava nlava = new Lava(Lavas[i]);
                nGameBoard.Lavas.Add(nlava);
            }

            nGameBoard.Players = new List <Player>();

            for (int i = 0; i < Players.Count; i++)
            {
                Player nplayer = new Player(Players[i]);
                nGameBoard.Players.Add(nplayer);
            }

            nGameBoard.XYinfo = new XYInfo[15, 15];

            for (int i = 0; i < nGameBoard.XYinfo.GetLength(0); i++)
            {
                for (int j = 0; j < nGameBoard.XYinfo.GetLength(1); j++)
                {
                    nGameBoard.XYinfo[i, j] = new XYInfo(XYinfo[i, j]);
                }
            }

            return(nGameBoard);
        }