Example #1
0
    private IEnumerator OpenQuestion()
    {
        //3 Question框打开
        questionContainer.SetActive(true);
        float t = 0, alpha = 0;

        while (t < 1)
        {
            t = Mathf.MoveTowards(t, 1, 1 / 0.5f * Time.fixedDeltaTime);
            float scale = 2 - t;
            if (t < 0.5)
            {
                alpha = t * 2;
            }
            questionContainer.transform.localScale            = new Vector3(scale, scale, 1);
            questionContainer.GetComponent <UIWidget>().alpha = alpha;
            yield return(null);
        }
        yield return(new WaitForSeconds(0.2f));

        //显示question 并闪烁
        QLabel.SetActive(true);
        for (int i = 0; i < 4; i++)
        {
            QLabel.GetComponent <UILabel>().color = Color.gray;
            yield return(new WaitForSeconds(0.1f));

            QLabel.GetComponent <UILabel>().color = Color.white;
            yield return(new WaitForSeconds(0.1f));
        }
        //移动Qustion到指定位置
        float x = 0;

        while (x > -225)
        {
            x = Mathf.MoveTowards(x, -225, 225 / 0.2f * Time.fixedDeltaTime);
            QLabel.transform.localPosition = new Vector3(x, QLabel.transform.localPosition.y);
            yield return(null);
        }
        //4 题目显示
        questionLabel.GetComponent <UILabel>().text = reasoningEvent.question;
        questionLabel.SetActive(true);
        TypewriterEffect te = questionLabel.GetComponent <TypewriterEffect>();

        while (te.isActive)
        {
            yield return(null);
        }
        yield return(new WaitForSeconds(0.5f));

        //5 选项依次显示
        StartCoroutine(ifevi ? ShowEvidence() : ShowChoice());
        //6 *血条展示
        hpmpManager.ShowBar();
    }
Example #2
0
    private IEnumerator OpenQuestion()
    {
        sm.SetBGM("puzzle");
        //恢复默认位置
        QLabel.transform.localPosition       = Vector3.zero;
        QLabel.GetComponent <UILabel>().text = "Question " + reasoningEvent.num;
        QLabel.SetActive(false);
        //3 Question框打开
        questionContainer.SetActive(true);
        float t = 0, alpha = 0;

        while (t < 1)
        {
            t = Mathf.MoveTowards(t, 1, 1 / 0.5f * Time.deltaTime);
            float scale = 2 - t;
            if (t < 0.5)
            {
                alpha = t * 2;
            }
            questionContainer.transform.localScale            = new Vector3(scale, scale, 1);
            questionContainer.GetComponent <UIWidget>().alpha = alpha;
            yield return(null);
        }
        yield return(new WaitForSeconds(0.2f));

        //显示question 并闪烁
        QLabel.SetActive(true);
        for (int i = 0; i < 4; i++)
        {
            QLabel.GetComponent <UILabel>().color = Color.gray;
            yield return(new WaitForSeconds(0.1f));

            QLabel.GetComponent <UILabel>().color = Color.white;
            yield return(new WaitForSeconds(0.1f));
        }
        //移动Qustion到指定位置
        t = 0;
        while (t < 1)
        {
            t = Mathf.MoveTowards(t, 1, 1 / 0.2f * Time.deltaTime);
            float x = t * -360;
            QLabel.transform.localPosition = new Vector3(x, QLabel.transform.localPosition.y);
            yield return(null);
        }
        //4 题目显示
        questionLabel.GetComponent <UILabel>().text = reasoningEvent.question;
        questionLabel.SetActive(true);
        TypewriterEffect te = questionLabel.GetComponent <TypewriterEffect>();

        te.ResetToBeginning();
        while (te.isActive)
        {
            yield return(null);
        }
        yield return(new WaitForSeconds(0.5f));

        //5 选项依次显示
        StartCoroutine(ifevi ? ShowEvidence() : ShowChoice());
        //6 *血条展示
        hpmpManager.gameObject.SetActive(true);
        hpmpManager.ShowBar(true, false);
    }