Exemplo n.º 1
0
        public void HoldPiece()
        {
            if (_canHold)
            {
                _activePiece.Despawn();

                if (_heldPiece == null)
                {
                    _heldPiece = _activePiece;
                    SpawnNextPiece();
                }
                else
                {
                    Tetrimino tempPiece = _heldPiece;
                    _heldPiece   = _activePiece;
                    _activePiece = tempPiece;
                    _activePiece.Spawn();
                    _activeOutline = GeneratePiece(_activePiece.GetBlockValue());
                }

                _holdSound.Play();
            }

            _canHold = false;
        }