public void OnEndTurn() { if (CurrentTiles.Count > 0) { if (CheckWords()) { _turnsSkipped = 0; CurrentTurn++; var points = CountPoints(); Player1.ChangeBox(7 - Player1.CurrentLetters.Count); CurrentTiles = new List <TileLAN>(); CurrentDirection = Direction.None; IsFirstTurn = false; if (_timerEnabled) { TimeRemaining = (float)_timerLength + 1; } Player1.ChangePlayer(PlayerNumber == 1 ? 2 : 1, points); if (Player1.CurrentLetters.Count == 0) { Player1.EndGame(); } } else { Controller.ShowNotExistError(); } } else { Controller.ShowZeroTilesError(); } _wordsFound = new List <TileLAN>(); }
//Removes stuck letter from field public void Fix() { parent.FreeCoordinates.Add(DragHandler.StartPosition); parent.ChangeBox(1, LetterText.text); var index = parent.FindIndex(this); parent.CurrentLetters[index] = parent.CurrentLetters[parent.CurrentLetters.Count - 1]; parent.CurrentLetters.RemoveAt(parent.CurrentLetters.Count - 1); transform.position = new Vector3(-500, -500); }