/// <summary> /// Increases the trade count for a player, starts an animation for the button /// Gets new letters and replaces the old letters /// </summary> /// <param name="timesTraded"></param> private void TradeLetters(int timesTraded) { if (GameInstance.instance.IsMultiplayer) { Hashtable hash = new Hashtable { { "TimesTraded", ++timesTraded } }; PhotonNetwork.LocalPlayer.SetCustomProperties(hash); } else { Player.TimesTraded++; } RemoveAllLetters(); var buttonImage = TradeBtn.GetComponentsInChildren <RectTransform>().Where(img => img.name == "TradeBtnImg").ToList()[0]; StartCoroutine(RotateTradeButton(buttonImage, 1)); List <LetterPosition> letterPositions = GetPlayerLetters(); char[] newLetters = TheLetterManager.GetLetters(letterPositions.Count()); for (int i = 0; i < letterPositions.Count; i++) { LetterPosition letterPos = letterPositions[i]; if (!letterPos.LetterBlock.IsFirstLetter && !letterPos.LetterBlock.IsSecondLetter) { letterPos.LetterBlock.GetComponentInChildren <Text>().text = newLetters[i].ToString().ToUpper(); } } }