예제 #1
0
파일: Board.cs 프로젝트: 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);
            }
        }
예제 #2
0
        private void SetCustomBoardSize()
        {
            var thisSize = new GameBoardSize(_customWidth, _customHeight);

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

            SelectedGameBoardSize = thisSize;
        }
예제 #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();
        }
예제 #4
0
 public GameBoardManager(BoardSizes size)
 {
     this.Data = new GameBoard(size);
 }