Ejemplo n.º 1
0
 public void SetComboScaleAnimation(int currentCombo, float delay = 0.025f)
 {
     if (comboTxt)
     {
         if (currentCombo > 0)
         {
             combo++;
             if (combo > GameStatisticsManager.Combo)
             {
                 GameStatisticsManager.Combo = combo;
             }
             comboTxt.gameObject.SetActive(true);
             comboTxt.text = currentCombo.ToString();
             UIAnimation.DoScale(comboTxtTransform, 1.5f, 0.25f, delay);
         }
         else
         {
             combo = 0;
             comboTxt.gameObject.SetActive(false);
             comboTxt.text = "1";
         }
     }
 }
    protected IEnumerator DORebornCountDown()
    {
        delta             = 0;
        timeStr           = "";
        timeStrLast       = "";
        rebornElapsedTime = 0;
        while (rebornElapsedTime < rebornElapsedMaxTime)
        {
            if (UIManager.CurPopup != null && UIManager.CurPopup.Status != UIAnimStatus.IsHide)
            {
                //Debug.LogWarning("CurPopup: Waiting for animation DONE");
            }
            else if (UIToast.toastType == ToastType.Loading && UIToast.Status != UIAnimStatus.IsHide)
            {
                //Debug.LogWarning("UIToast: Waiting for animation DONE");
            }
            else
            {
                delta              = 1 - rebornElapsedTime / rebornElapsedMaxTime;
                rebornElapsedTime += Time.deltaTime;

                if (rebornByCountDownImage)
                {
                    rebornByCountDownImage.fillAmount = delta;
                }

                if (rebornByCountDownImageDotTransform)
                {
                    rebornByCountDownImageDotTransform.SetLocalRotation2D(delta * 360f);
                }

                if (rebornByCountDownText)
                {
                    int timeCount = Mathf.FloorToInt(rebornElapsedMaxTime - rebornElapsedTime);

                    if (timeCount <= 3)
                    {
                        noThanksButton?.gameObject.SetActive(true);
                    }

                    if (timeCount >= 0)
                    {
                        timeStrLast = timeCount.ToString("#0");
                    }
                    else
                    {
                        timeStrLast = "!?";
                    }

                    if (timeStr != timeStrLast)
                    {
                        timeStr = timeStrLast;
                        rebornByCountDownText.text = timeStr;
                        UIAnimation.DoScale(rebornByCountDownText.transform, 1.2f, 0.25f, 0);
                        if (rebornElapsedTime >= 0.5f && !string.IsNullOrEmpty(timeStrLast))
                        {
                            SoundManager.Play("sfx_timer_" + (timeCount % 2));
                        }
                    }
                }
            }
            yield return(null);
        }
        rebornElapsedTime = 9999;
        //NoReborn();
    }