MageDialog.textDisplay popQueueText() { MageDialog.textDisplay pop = (MageDialog.textDisplay)displayQueue [0]; displayQueue.RemoveAt(0); return(pop); }
void Update() { if (displaying) { if (mageCountDown >= 0) { mageCountDown -= Time.deltaTime; } else { panel.SetActive(true); if (displayQueue.Count > 0) { AnimatorStateInfo info = textAnimator.GetCurrentAnimatorStateInfo(0); int state1 = Animator.StringToHash("Base.TextHidden"); int state2 = Animator.StringToHash("Base.TextVisible"); if (textCountDown <= 0 && info.nameHash == state1) { MageDialog.textDisplay next = popQueueText(); textDisplay.text = next.displayText; textCountDown = next.displayTime; textAnimator.SetTrigger("showText"); } if (info.nameHash == state2) { textCountDown -= Time.deltaTime; if (textCountDown <= 0) { textAnimator.SetTrigger("hideText"); } } } else { textCountDown -= Time.deltaTime; if (textCountDown <= 0) { textAnimator.SetTrigger("hideText"); } else { return; } AnimatorStateInfo info = textAnimator.GetCurrentAnimatorStateInfo(0); int state1 = Animator.StringToHash("Base.TextHidden"); int state2 = Animator.StringToHash("Base.TextVisible"); if (info.nameHash == state1) { displaying = false; mage.setMageToDissapear(); playerScript.movementDisabled = false; gameObject.SetActive(false); panel.SetActive(false); } } } } else { mageCountDown = 8.5f; } }