Beispiel #1
0
        private bool _isShadow; // true if the piece is a shadow at the bottom of the grid

        #endregion Fields

        #region Constructors

        //--------------------------------------------------------------
        // CONSTRUCTORS
        //--------------------------------------------------------------
        public PieceView(Piece piece, bool isShadow)
        {
            // Associate the instances
            _piece = piece;
            _isShadow = isShadow;

            // Create the associated BlockViews
            _blocksView = new BlockView[Constants.BlockPerPiece];
            for (uint i = 0 ; i < Constants.BlockPerPiece ; i++)
            {
                _blocksView[i] = new BlockView(_piece._blocks[i], isShadow);
            }
        }
Beispiel #2
0
        public void Init(Grid grid)
        {
            // Associate the instance
            _grid = grid;

            // Create the associated PieceViews
            _fallingPieceView = new PieceView(_grid._fallingPiece, false);
            _shadowPieceView = new PieceView(_grid._shadowPiece, true);

            // Create the associated BlockViews
            _mapView = new BlockView[Constants.GridSizeX, Constants.GridSizeY];
            for (uint i = 0 ; i < _grid._map.GetLength(0) ; i++)
            {
                for (uint j = 0 ; j < _grid._map.GetLength(1) ; j++)
                {
                    _mapView[i,j] = new BlockView(_grid._map[i,j], false);
                }
            }

            _mutexView = new Mutex(false);
        }