public void AddCardInPileList(string id) { CardTumb card = (WhotConstants.CreateDuplicate(pileCardTumb.gameObject)).GetComponent <CardTumb>(); card.GetComponent <RectTransform>().sizeDelta = new Vector2(190f, 250f); card.name = id; if (!WhotManager.instance.pileCardIds.Contains(id)) { WhotManager.instance.pileCardIds.Add(id); } card.SetCardName(id, false); card.transform.localPosition = new Vector3(pileCardTumb.transform.localPosition.x, pileCardTumb.transform.localPosition.y, pileZPos); pileZPos -= 0.01f; }
/// <summary> /// Updates the displayed cards. /// </summary> /// <param name="userCards">User cards.</param> public int UpdateCardTumb(List <string> userCards, bool showCard) { Transform parent = tumb.transform.parent; int sumOfCards = 0; for (int i = 1; i < parent.childCount; i++) { Destroy(parent.GetChild(i).gameObject); } foreach (string id in userCards) { CardTumb card = (WhotConstants.CreateDuplicate(tumb.gameObject)).GetComponent <CardTumb>(); card.name = id; card.SetCardName(id, showCard); int cardNumPlayed = int.Parse(id.Substring(3, id.Length - 3)); sumOfCards += cardNumPlayed; } return(sumOfCards); }
public void AddCardInPlayedList(string id) { CardTumb card = (WhotConstants.CreateDuplicate(playedCardTumb.gameObject)).GetComponent <CardTumb>(); card.name = id; if (!WhotManager.instance.playedCardIds.Contains(id)) { WhotManager.instance.playedCardIds.Add(id); } card.SetCardName(id); card.transform.localPosition = new Vector3(playedCardTumb.transform.localPosition.x, playedCardTumb.transform.localPosition.y, playedCardZPos); card.transform.localRotation = Quaternion.Euler(0f, 0f, Random.Range(0, 359f)); playedCardZPos -= 0.01f; if (playedparent.transform.childCount > 3) { Transform lastPlayedCard = playedparent.GetChild(playedparent.transform.childCount - 2); GameObject fbxCard = lastPlayedCard.Find("whot").gameObject; fbxCard.GetComponent <MeshRenderer>().material = standardMat; } }