private void Update() { if (ActiveTetromino == null) { return; } _autoMoveDownCounter -= Time.deltaTime; bool didMove = false; bool didLand = false; bool didRotate = false; if (_input.MoveLeft) { didMove = TryMoveTetromino(ActiveTetromino, new Vector2(-1.0f, 0.0f)); } if (_input.MoveRight) { didMove = TryMoveTetromino(ActiveTetromino, new Vector2(1.0f, 0.0f)); } if (_input.MoveDown || _autoMoveDownCounter <= 0.0f) { _autoMoveDownCounter = MoveDownInterval; bool couldMove = TryMoveTetromino(ActiveTetromino, new Vector2(0.0f, -1.0f)); didLand = !couldMove; didMove = couldMove; if (!couldMove) { PlaceTetrominoOnPlayfield(ActiveTetromino); } } if (_input.HardDrop) { while (TryMoveTetromino(ActiveTetromino, new Vector2(0.0f, -1.0f))) { ; } PlaceTetrominoOnPlayfield(ActiveTetromino); didLand = true; } if (_input.RotateClockwise) { didRotate = TryRotateTetromino(ActiveTetromino, new Vector3(0.0f, 0.0f, -90.0f)); } if (_input.RotateCounterClockwise) { didRotate = TryRotateTetromino(ActiveTetromino, new Vector3(0.0f, 0.0f, 90.0f)); } if (didRotate) { _soundManager.PlaySoundWithIdentifier(SoundIds.RotatedTetromino); ActiveTetromino.AdjustTetrominoChildBlocksRotation(); } if (didMove) { _soundManager.PlaySoundWithIdentifier(SoundIds.MovedTetromino); } if (didLand) { _soundManager.PlaySoundWithIdentifier(SoundIds.LandedTetromino); } }