private void CatchPlayerInput() { Touch[] touches = Input.touches; foreach (Touch touch in touches) { Ray ray = Camera.main.ScreenPointToRay(new Vector3(touch.position.x, touch.position.y, 1)); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.GetComponent <Cell>() && touch.phase == TouchPhase.Began) { Cell cell = hit.collider.gameObject.GetComponent <Cell>(); if (!cell.isChecked && !cell.isOpened) { if (flagToDeminingToggle.isFlagSelected) { // Ставим Флаг flagsController.flagsCount--; flagsController.UpdateFlagsUI(); cell.SetFlag(); if (cell.CellStatus == "*") { minesDefused++; CheckLevelComplete(); } } else { OpenCell(cell); CheckLevelComplete(); } continue; } if (cell.isChecked && flagToDeminingToggle.isFlagSelected) { // Снимаем флаг flagsController.flagsCount++; flagsController.UpdateFlagsUI(); cell.ResetFlag(); if (cell.CellStatus == "*") { minesDefused--; CheckLevelComplete(); } } } } } }