Ejemplo n.º 1
0
    private static IEnumerator TweenText(Text pText, string strTextDest, float fValue, OnLerpText_WhenTween OnLerpText, System.Func <float, float, float> OnCalculateProgress)
    {
        pText.text = "";

        float fProgress_0_1 = 0f;

        while (fProgress_0_1 < 1f)
        {
            int iCutLength = (int)(strTextDest.Length * fProgress_0_1);
            OnLerpText(pText, strTextDest, iCutLength);
            fProgress_0_1 += OnCalculateProgress(fValue, fProgress_0_1);
            yield return(null);
        }

        pText.text = strTextDest;
    }
Ejemplo n.º 2
0
    public static Coroutine DoPlayTween_BySpeed(this Text pText, MonoBehaviour pCoroutineExecuter, string strTextDest, float fSpeed, OnLerpText_WhenTween OnLerpText)
    {
        if (pCoroutineExecuter.gameObject.activeInHierarchy == false)
        {
            Debug.LogWarning($"{pCoroutineExecuter.name} - {nameof(DoPlayTween)} activeInHierarchy == false", pCoroutineExecuter);
            return(null);
        }

        return(pCoroutineExecuter.StartCoroutine(TweenText(pText, strTextDest, fSpeed, OnLerpText, OnCalculateProgress_Speed)));
    }