Example #1
0
 public void RenderCard(CardYasir cardInfo, CardController card)
 {
     card.cardId            = cardInfo.cardId;
     card.cardValue         = cardInfo.cardValue;
     card.cardSprite.sprite = cardInfo.cardSprite;
     card.cardType          = cardInfo.cardType;
 }
Example #2
0
    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);
    }
Example #3
0
 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);
     }
 }
Example #4
0
    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);
        }
    }