Esempio n. 1
0
File: Board.cs Progetto: heyx3/FiaCR
        public void FromStream(BinaryReader stream)
        {
            ClearBoard();

            Seed      = stream.ReadInt32();
            BoardSize = (BoardSizes)stream.ReadInt32();

            //If the board size is different, resize the arrays.
            if (Pieces.GetLength(0) != (int)BoardSize)
            {
                ResetArrays();
            }

            //Read the pieces.
            int nPieces = stream.ReadInt32();

            for (int i = 0; i < nPieces; ++i)
            {
                Teams    team = (Teams)stream.ReadInt32();
                Vector2i pos  = new Vector2i(stream.ReadInt32(), stream.ReadInt32());
                AddElement(false, pos, team);
            }

            //Read the hosts.
            int nHosts = stream.ReadInt32();

            for (int i = 0; i < nHosts; ++i)
            {
                Teams    team = (Teams)stream.ReadInt32();
                Vector2i pos  = new Vector2i(stream.ReadInt32(), stream.ReadInt32());
                AddElement(true, pos, team);
            }
        }
        private void SetCustomBoardSize()
        {
            var thisSize = new GameBoardSize(_customWidth, _customHeight);

            if (!BoardSizes.Contains(thisSize))
            {
                BoardSizes.Add(thisSize);
            }

            SelectedGameBoardSize = thisSize;
        }
Esempio n. 3
0
        public void Create(BoardSizes size)
        {
            if (size == BoardSizes.Extended)
            {
                throw new Exception("Extended boards not implemented.");
            }

            this.CreateLocations();

            this.Trails = new Trail[StandardBoardTrailCount];

            var index = this.StitchLocationsTogetherUsingVerticalTrails();

            this.StitchLocationsTogetherUsingHorizontalTrails(index);

            this.CreateResourcesProvider();
        }
Esempio n. 4
0
 public GameBoardManager(BoardSizes size)
 {
     this.Data = new GameBoard(size);
 }