public void RenderCard(CardYasir cardInfo, CardController card) { card.cardId = cardInfo.cardId; card.cardValue = cardInfo.cardValue; card.cardSprite.sprite = cardInfo.cardSprite; card.cardType = cardInfo.cardType; }
public void CreateCard(CardYasir cardInfo, Transform startPos, Transform cardPos, List <CardController> cardList) { //GameObject newCard = Instantiate(cardPrefab, startPos); //newCard.transform.SetParent(cardPos); GameObject newCard = Instantiate(cardPrefab); SetCardMovement(cardInfo, newCard, startPos, cardPos, cardList); }
public CardYasir Draw() { if (cardIds.Count > 0) { CardYasir drawnCard = CM.GetCard(cardIds[cardIds.Count - 1]); cardIds.RemoveAt(cardIds.Count - 1); playerStatus.UpdateDeckUI(); return(drawnCard); } else { return(null); } }
public void SetCardMovement(CardYasir cardInfo, GameObject newCard, Transform startPos, Transform cardPos, List <CardController> cardList, bool render = true) { newCard.transform.SetParent(startPos); newCard.transform.localPosition = Vector3.zero; newCard.transform.SetParent(cardPos); CardController newCardController = newCard.GetComponent <CardController>(); newCardController.enabled = true; cardList.Add(newCardController); newCardController.targetPos = new Vector3((cardList.Count - 1) * 1.5f, 0, 0); newCardController.moving = true; if (render) { RenderCard(cardInfo, newCardController); } }