示例#1
0
    private IEnumerator GetCardAnim(GameObject card)
    {
        Vector3        posNow  = card.transform.localPosition;
        SmothTransform ST      = card.GetComponent <SmothTransform> ();
        Vector3        upPos   = new Vector3(posNow.x, posNow.y + UpPos, posNow.z);
        Vector3        downPos = new Vector3(posNow.x, posNow.y + DownPos, posNow.z);

        ST.SmothTransformTo(upPos, 10);
        yield return(new WaitForSeconds(0.1f));

        ST.SmothTransformTo(downPos, 10);
    }
示例#2
0
 private void ReturnToStartPosision()
 {
     //Debug.Log ("return to start pos: " + this.gameObject.name);
     // transform.position = startPos;
     cardSpriteRender.sortingOrder = startLayer;
     if (HandComp)
     {
         HandComp.SortCardsInHand();
     }
     else
     {
         SmoothTrComp.SmothTransformTo(pawnStartPosition, 30);
     }
     //  transform.localScale = startScale;
     // transform.localEulerAngles = startRotation;
 }
示例#3
0
    public void CenterOnItem(RectTransform target)
    {
        // Item is here
        var itemCenterPositionInScroll = GetWorldPointInWidget(mScrollTransform, GetWidgetWorldPoint(target));

        Debug.Log("Item Anchor Pos In Scroll: " + itemCenterPositionInScroll);
        // But must be here
        var targetPositionInScroll = GetWorldPointInWidget(mScrollTransform, GetWidgetWorldPoint(_MaskTransform));

        Debug.Log("Target Anchor Pos In Scroll: " + targetPositionInScroll);
        // So it has to move this distance
        var difference = targetPositionInScroll - itemCenterPositionInScroll;

        difference.z = 0f;

        //clear axis data that is not enabled in the scrollrect
        if (!mScrollRect.horizontal)
        {
            difference.x = 0f;
        }

        if (!mScrollRect.vertical)
        {
            difference.y = 0f;
        }

        //this is the wanted new position for the content
        var newAnchoredPosition = mContent.anchoredPosition3D + difference;

        if (_Snap)
        {
            mContent.anchoredPosition3D = newAnchoredPosition;
        }
        else
        {
            SmothTrans.TrackPosition = true;
            SmothTrans.SmothTransformTo(newAnchoredPosition, 12);
            //DOTween.To (() => mContent.anchoredPosition, x => mContent.anchoredPosition = x, newAnchoredPosition, _AnimTime);
        }
    }
示例#4
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);
            }
        }
    }
示例#5
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());
        }
    }
示例#6
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);
        }
    }