Exemple #1
0
    private IEnumerator AddCardFromPack(GameObject card, GameObject panel, int i, CardsBase.CardDescriptionClass cardDesc)
    {
        SmothTransform ST = card.GetComponent <SmothTransform> ();

        yield return(new WaitForSeconds(0.5f));

        yield return(new WaitForSeconds(0.1f * i));

        card.transform.SetParent(panel.transform, true);
        ST.SmothTransformTo(new Vector3(0, 0, 0), Quaternion.identity, MovingSpeed);
        ST.SmoothScaleTo(new Vector3(CardReversEndScale, CardReversEndScale, CardReversEndScale), MovingSpeed);
        if (cardDesc != null)
        {
            if (cardDesc.Rarity == CardInteraction.CardRarityEnum.gold)
            {
                Instantiate(GoldCardRay, card.transform);
            }
            else if (cardDesc.Rarity == CardInteraction.CardRarityEnum.diamond)
            {
                Instantiate(DiamondCardRay, card.transform);
            }
        }
    }
Exemple #2
0
    private IEnumerator CardAnimation(Vector3 newPos, Vector3 newScale, GameObject UnblockedCard)
    {
        if (UnblockedCard != null)
        {
            DisableOtherCards(UnblockedCard);
        }
        else
        {
            DisableOtherCards(null);
        }
        SmothTransform SMT = GetComponent <SmothTransform> ();

        SMT.smoothTransformPosRunning   = false;
        SMT.smoothTransformScaleRunning = false;
        SMT.SmothTransformTo(newPos, 10);
        SMT.SmoothScaleTo(newScale, 10);
        yield return(new WaitForSeconds(0.5f));

        if (UnblockedCard == null)
        {
            StartCoroutine(EnableOtherCardsDelayed());
        }
    }
Exemple #3
0
    public void AddCardToStartHand(GameObject card, int CardNumber)
    {
        Debug.Log("Add card :" + card);
        bool found = false;

        foreach (GameObject panel in PanelsList)
        {
            if (panel != null)
            {
                StartHandPanel handPanel = panel.GetComponent <StartHandPanel> ();
                if (handPanel.CardDeckNumber == CardNumber)
                {
                    Debug.Log("found free panel :" + panel);
                    if (handPanel.Card != null)
                    {
                        Destroy(handPanel.Card);
                    }
                    handPanel.Card = card;
                    handPanel.StartHandComponent = GetComponent <StartHand> ();
                    card.GetComponent <CardInteraction> ().cardHandIndex = PanelsList.IndexOf(panel);
                    card.transform.SetParent(panel.transform);
                    SmothTransform STF = card.GetComponent <SmothTransform> ();
                    STF.SmoothScaleTo(new Vector3(CardScale, CardScale, CardScale), 10);
                    Quaternion rot = Quaternion.identity;
                    rot.eulerAngles = new Vector3(0, 0, 0);
                    STF.SmothTransformTo(CardPosition, rot, 10);
                    found = true;
                    break;
                }
            }
        }
        if (!found)
        {
            card.GetComponent <CardInteraction> ().SetCardInterationsEnable(true);
            HandComponent.AddCardToHand(card);
        }
    }