Exemplo n.º 1
0
    //抽一张卡
    public CardControl CreateCard(CardInfo cardInfo)
    {
        GameObject  newCard  = Instantiate(cardPrefab, transform);
        CardControl cardCtrl = newCard.GetComponent <CardControl>();

        cardCtrl.Init(cardInfo);
        return(cardCtrl);
    }
Exemplo n.º 2
0
    /// 创建卡牌
    public Card CreateCard(string name, int value, Type dataType, int id, CardTypeEnum typeEnum)
    {
        Card card = new Card(name, value);

        card.SetDataFrom(dataType, id);
        card.SetCardType(typeEnum);

        CardControl cc = new CardControl();

        cc.Init(card);
        cardUUId2Control.Add(card.UUID, cc);
        return(card);
    }
Exemplo n.º 3
0
    //在抽卡动画结束后生成要添加进手牌的卡
    public IEnumerator CardToAddInHand(CardInfo newCard, CardControl card)
    {
        yield return(new WaitForSeconds(1f));

        Vector3 newCardPos = new Vector3(471, 381, 0);
        //GameObject newCardAddInCard = Instantiate(cardPrefab, handCardManager.transform);

        GameObject  newCardAddInCard = Instantiate(cardPrefab, handCardManager.transform);
        CardControl cardCtrl         = newCardAddInCard.GetComponent <CardControl>();

        cardCtrl.Init(newCard);
        handCardManager.cardsInHand.Add(cardCtrl);

        DestroyImmediate(newCardAddInCard.GetComponent <Animator>());
        newCardAddInCard.transform.localScale    = new Vector3(0.25f, 0.25f, 1);
        newCardAddInCard.transform.localPosition = newCardPos;
        newCardAddInCard.transform.localRotation = Quaternion.identity;
        handCardManager.Arrange();

        Destroy(card.gameObject);
    }