Exemple #1
0
        private void LockActivePiece()
        {
            _map         = RemoveCompleteLines(GetCompleteMap());
            _activePiece = new ActivePiece();
            Draw();

            if (!IsValidPosition())
            {
                GameOver = true;
            }
        }
Exemple #2
0
        public void MoveActivePiece(string movement)
        {
            var previousPosition = _activePiece.DeepCopy();

            switch (movement)
            {
            case ("left"):
                _activePiece.MoveLeft();
                break;

            case ("right"):
                _activePiece.MoveRight();
                break;

            case ("rotateLeft"):
                _activePiece.RotateLeft();
                break;

            case ("rotateRight"):
                _activePiece.RotateRight();
                break;

            case ("down"):
                _activePiece.MoveDown();
                break;

            default:
                _activePiece = previousPosition;
                return;
            }

            if (IsValidPosition())
            {
                Draw();
                return;
            }

            _activePiece = previousPosition;

            if (movement == "down")
            {
                LockActivePiece();
            }
        }
Exemple #3
0
 public Board()
 {
     _map         = Maps.EmptyBoard();
     _activePiece = new ActivePiece();
     GameOver     = false;
 }