private void Update() { if (!_isGameOver) { if (!_isColumnsMoving) { var action = _inputController.DetectAction(); if (action.isActionHappened) { var secondElementCoordinates = action.elementToMoveCoordinates + action.moveDirection; if (_fieldModel.IsElementInField(secondElementCoordinates)) { var matchedElements = _fieldModel.FindMatchedElements(action.elementToMoveCoordinates, secondElementCoordinates); _isMatchedElementsExist = matchedElements.Count > 0; if (_isMatchedElementsExist) { _isFirstMatch = true; _fieldModel.ReplaceElements(action.elementToMoveCoordinates, secondElementCoordinates); _fieldModel.DeleteElements(matchedElements); _scoreCounter.AddScore(matchedElements); _isColumnsMoving = true; _fieldModel.ShiftElements(); } if (_isFirstMatch) { _turnsCounter.СountTurn(); _isFirstMatch = false; } } } } } }