private void LockActivePiece() { _map = RemoveCompleteLines(GetCompleteMap()); _activePiece = new ActivePiece(); Draw(); if (!IsValidPosition()) { GameOver = true; } }
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(); } }
public Board() { _map = Maps.EmptyBoard(); _activePiece = new ActivePiece(); GameOver = false; }