Example #1
0
        private void ExecuteMove()
        {
            if (_grid.IsValidMove(_currentMove))
            {
                _storage.Record(_grid);

                _currentMove.Check();

                bool vertical = _currentMove.first.Coordinates.y != _currentMove.second.Coordinates.y;

                // Clear first number's row if necessary
                if (_grid.IsRowEmpty(_currentMove.first.Coordinates.y))
                {
                    StartCoroutine(_grid.ClearRow(_currentMove.first.Coordinates.y));
                }

                // Clear second number's row if different from the first and necessary
                if (vertical && _grid.IsRowEmpty(_currentMove.second.Coordinates.y))
                {
                    StartCoroutine(_grid.ClearRow(_currentMove.second.Coordinates.y));
                }

                CheckGameOverConditions();

                Save();
            }
            else
            {
                _currentMove.ResetState();
            }

            ResetHint();

            _currentMove.Clear();
        }
Example #2
0
 private void ResetHint()
 {
     _currentHint.Highlight(false);
     _currentHint.Clear();
 }