Ejemplo n.º 1
0
        /// <summary>
        /// Method to change the fixed letters after a word is placed
        /// </summary>
        /// <param name="madeWord"></param>
        /// <param name="isBot"></param>
        public void ChangeFixedLetters(string madeWord, bool isBot = false)
        {
            TheLetterManager.SecondLetter = TheLetterManager.FirstLetter;
            var lastIndex = madeWord.Length;

            TheLetterManager.FirstLetter = madeWord[lastIndex - 1];

            if (isBot)
            {
                FirstLetterBlock.GetComponentInChildren <Text>().text     = TheLetterManager.FirstLetter.ToString().ToUpper();
                SecondLetterBlock.GetComponentInChildren <Text>().text    = TheLetterManager.SecondLetter.ToString().ToUpper();
                FirstLetterBlock.GetComponentsInChildren <Text>()[1].text = TheLetterManager.CharactersValues
                                                                            .First(x => x.Key == char.ToLower(TheLetterManager.FirstLetter)).Value.ToString();
                SecondLetterBlock.GetComponentsInChildren <Text>()[1].text = TheLetterManager.CharactersValues
                                                                             .First(x => x.Key == char.ToLower(TheLetterManager.SecondLetter)).Value.ToString();
                RemoveAllLetters();
            }
            else
            {
                GameObject parentRow   = GetRightRow(1);
                Transform  placeHolder = parentRow.transform.GetChild(0);
                DestroyImmediate(placeHolder.gameObject);
                FirstLetterBlock = InstantiateLetterButton('?', true, false, 1, 0);
                parentRow        = GetRightRow(1);
                placeHolder      = parentRow.transform.GetChild(1);
                DestroyImmediate(placeHolder.gameObject);
                SecondLetterBlock = InstantiateLetterButton('?', false, true, 1, 1);

                if (GameInstance.instance.IsMultiplayer)
                {
                    _gameBoard.CallRPCPlaceLtrz(TheLetterManager.FirstLetter.ToString(), true, false, 1, 0, 1);
                    _gameBoard.CallRPCPlaceLtrz(TheLetterManager.SecondLetter.ToString(), false, true, 1, 1, 1);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Trade the fixed letters for two random ones
 /// </summary>
 private void OnTradeFixedTouched()
 {
     BoosterTouched(() =>
     {
         TheLetterManager.FirstLetter  = TheLetterManager.GetVowelOrConsonant(GameInstance.instance.difficulty == Difficulty.Medium);
         TheLetterManager.SecondLetter = TheLetterManager.GetVowelOrConsonant(GameInstance.instance.difficulty != Difficulty.Hard);
         FirstLetterBlock.GetComponentInChildren <Text>().text      = TheLetterManager.FirstLetter.ToString().ToUpper();
         SecondLetterBlock.GetComponentInChildren <Text>().text     = TheLetterManager.SecondLetter.ToString().ToUpper();
         FirstLetterBlock.GetComponentsInChildren <Text>()[1].text  = TheLetterManager.CharactersValues.FirstOrDefault(x => x.Key == TheLetterManager.FirstLetter).Value.ToString().ToUpper();
         SecondLetterBlock.GetComponentsInChildren <Text>()[1].text = TheLetterManager.CharactersValues.FirstOrDefault(x => x.Key == TheLetterManager.SecondLetter).Value.ToString().ToUpper();
     }, 20, Booster4);
 }