Пример #1
0
    public IEnumerator ScaleCardIn()
    {
        if (cardDisplay)
        {
            cardDisplay.gameObject.GetComponent <Canvas>().sortingOrder = 1;
        }

        Vector3 originalScale = display.transform.localScale;
        Vector3 destinationScale;
        Vector3 originalPosition = display.transform.localPosition;
        Vector3 destinationPosition;

        //active l'info bulle pour le draft
        if (inDraft && cardDisplay)
        {
            print("activeInfoBulle");
            cardDisplay.ActiveInfoWindow();
        }

        if (!isDrawBtn)
        {
            destinationScale    = new Vector3(1.8f, 1.8f, 0);
            destinationPosition = new Vector3(0, 230, -100);
        }
        else
        {
            destinationScale    = new Vector3(1f, 1f, 1f);
            destinationPosition = new Vector3(0, 25, -100);
        }

        float currentTime = 0.0f;

        while (/*currentTime <= timeHover && */ isHover && (display.transform.localPosition - destinationPosition).magnitude > 0.01f)
        {
            //display.transform.localScale = Vector3.Lerp(originalScale, destinationScale, currentTime/timeHover);
            //display.transform.localPosition = Vector3.Lerp(originalPosition, destinationPosition, currentTime/timeHover);

            display.transform.localScale = Vector3.Lerp(display.transform.localScale, destinationScale, Time.deltaTime * 10f);
            //on change la position que si on est pas dans le draft
            if (!inDraft)
            {
                display.transform.localPosition = Vector3.Lerp(display.transform.localPosition, destinationPosition, Time.deltaTime * 10f);
            }

            currentTime += Time.deltaTime;
            yield return(null);
        }
        display.transform.localScale = destinationScale;
        if (!inDraft)
        {
            display.transform.localPosition = destinationPosition;
        }

        //active l'info bulle
        if (cardDisplay)
        {
            //print("activeInfoBulle");
            cardDisplay.ActiveInfoWindow();
        }
    }