Пример #1
0
 public Piece(Piece piece)
 {
     _shape = piece._shape;
     _color = piece._color;
     _blocks = new Block[Constants.BlockPerPiece];
     _angle = piece._angle;
     for (uint i = 0 ; i < Constants.BlockPerPiece ; i++)
     {
         _blocks[i] = new Block(piece._blocks[i]);
     }
 }
Пример #2
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);
            }
        }
Пример #3
0
 //--------------------------------------------------------------
 // CONSTRUCTORS
 //--------------------------------------------------------------
 public Player(string name)
 {
     _name = name;
     _score = 0;
     _level = Constants.MinLevel;
     _removedRows = 0;
     _grid = new Grid();
     _proposedPieces = new Piece[Constants.NbProposedPiece];
     for(int i = 0; i < Constants.NbProposedPiece; i++)
     {
         _proposedPieces[i] = new Piece(0, 0, Constants.IdGeneratorPlayer2);
         _proposedPieces[i].MoveToZero();
     }
 }
Пример #4
0
 public void UpdateShadowPiece(Piece piece)
 {
     _color = piece._color;
     _shape = piece._shape;
     _angle = piece._angle;
     for (uint i = 0 ; i < Constants.BlockPerPiece ; i++)
     {
         _blocks[i]._x = piece._blocks[i]._x;
         _blocks[i]._y = piece._blocks[i]._y;
         _blocks[i]._color = piece._color;
     }
 }
Пример #5
0
        public void Update(Piece piece, bool isShadow)
        {
            // Associate the new instances
            _piece = piece;
            _isShadow = isShadow;

            // Update the BlockViews
            for (uint i = 0; i < Constants.BlockPerPiece; i++)
            {
                _blocksView[i].Update(_piece._blocks[i], isShadow);
            }
        }
Пример #6
0
 public void ChangeProposedPiece(int i)
 {
     _proposedPieces[i] = new Piece(0, 0, Constants.IdGeneratorPlayer2);
     _proposedPieces[i].MoveToZero();
 }