Example #1
0
        private void LandShape()
        {
            _currentlyActiveShape.MoveUp();

            _gameBoard.StoreShapeInGrid(_currentlyActiveShape);

            int numberOfClearedRows = _gameBoard.ClearAllRows();

            if (numberOfClearedRows <= 0)
            {
                _currentlyActiveShape.LandShapeFx(glowSquareFx);
            }
            else
            {
                _soundManager.PlayClearRowSound(0.5f);
                _scoreManager.ScoreLines(numberOfClearedRows);

                if (_scoreManager.GetDidLevelUp())
                {
                    _dropInterval = Mathf.Clamp(_dropInterval - (_scoreManager.GetLevel() - 1) * 0.025f, 0.05f, 1f);
                    _soundManager.PlayLevelUpSound();
                }
            }

            if (_ghostShape)
            {
                _ghostShape.ResetGhostShape();
            }

            if (_shapeHolder)
            {
                _shapeHolder.CanRelease = true;
            }

            _currentlyActiveShape = _spawner.SpawnShape();

            _timeToNextKeyLeftRight = Time.time;
            _timeToNextKeyDown      = Time.time;
            _timeToNextKeyRotate    = Time.time;

            _soundManager.PlayDropSound();
        }