示例#1
0
        public VGTile GetRandomBorderTile(int mOffset = 0)
        {
            Debug.Assert(mOffset >= 0);
            Debug.Assert(Width - mOffset >= mOffset);
            Debug.Assert(Height - mOffset >= mOffset);

            List <VGTile> tiles = new List <VGTile>();

            if (Width - mOffset - 1 <= 0 || Height - mOffset - 1 <= 0)
            {
                return(null);
            }

            for (int iX = mOffset; iX < Width - mOffset; iX++)
            {
                tiles.Add(Tiles[iX, 0]);
                tiles.Add(Tiles[iX, Height - mOffset - 1]);
            }

            for (int iY = mOffset; iY < Height - mOffset; iY++)
            {
                tiles.Add(Tiles[0, iY]);
                tiles.Add(Tiles[Width - mOffset - 1, iY]);
            }

            return(tiles.Count == 0 ? null : tiles[VGUtils.GetRandomInt(0, tiles.Count)]);
        }
示例#2
0
        public VGTile GetRandomTile(int mOffset = 0)
        {
            Debug.Assert(mOffset >= 0);
            Debug.Assert(Width - mOffset >= mOffset);
            Debug.Assert(Height - mOffset >= mOffset);

            return(Tiles[VGUtils.GetRandomInt(mOffset, Width - mOffset), VGUtils.GetRandomInt(mOffset, Height - mOffset)]);
        }