예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Space))
     {
         OnClick();
     }
     if (!textBoxController.TextBox.activeSelf || !TextControl)
     {
         textUpdateTime += Time.deltaTime; //TextBox非表示の時にテキストの更新時間を遅延させる
     }
     if (Input.GetMouseButtonDown(1) && !textBoxController.View && TextControl)
     {
         textBoxController.SwitchTextBox();
     }
     if (textBoxController.TextBox.activeSelf && TextControl)
     {
         if (currentText.Length > textCount)
         {
             cursorAnim.SetBool("wait", true);
             if (textUpdateInterval == 0)
             {
                 textCount   = currentText.Length;
                 uiText.text = currentText.Substring(0, currentText.Length);
             }
             else
             {
                 textCount = (int)((Time.time - textUpdateTime) / textUpdateInterval);
                 if (textCount > currentText.Length)
                 {//クリックで経過した時間がテキストの長さの経過時間を超えた時
                     uiText.text        = currentText.Substring(0, currentText.Length);
                     textUpdateInterval = 0;
                 }
                 else
                 {
                     uiText.text = currentText.Substring(0, textCount);
                 }
             }
         }
         else
         {
             cursorAnim.SetBool("wait", false);
         }
     }
 }
예제 #2
0
    private IEnumerator FadeIn()
    {
        float fadeVal  = 0;
        float fadeTime = 1.6f;

        stillView.gameObject.SetActive(true);
        textBoxController.ViewCGs();
        textBoxController.SwitchTextBox();
        while (true)
        {
            fadeVal        += Time.deltaTime;
            stillView.color = new Color(1, 1, 1, fadeVal / fadeTime);
            if (fadeVal >= fadeTime)
            {
                break;
            }
            yield return(null);
        }
        textBoxController.ViewCGs();
        textBoxController.SwitchTextBox();
        yield break;
    }