예제 #1
0
    void Update()
    {
        // 文章の表示完了
        if (IsDisplayComplete())
        {
            if (one)
            {
                Instantiate(clickIconObj);
                one = false;
            }

            //最後の文章ではない & ボタンが押された
            if (currentSentenceNum < sentences.Length &&
                Input.GetMouseButton(0) &&
                GameObject.FindWithTag("ClickIcon") == true)
            {
                SetNextSentence();
                events.MoveAnimation(a);
                one = true;
            }
        }

        //表示される文字数を計算
        int displayCharCount = (int)(Mathf.Clamp01((Time.time - timeBeganDisplay) / timeUntilDisplay) * currentSentence.Length);

        //表示される文字数が表示している文字数と違う
        if (displayCharCount != lastUpdateCharCount)
        {
            uiText.text = currentSentence.Substring(0, displayCharCount);
            //表示している文字数の更新
            lastUpdateCharCount = displayCharCount;
        }

        //最後の文章が来たら次は文章を削除
        if (currentSentenceNum == sentences.Length)
        {
            Destroy(gameObject);
        }
    }
예제 #2
0
    bool one = true;                                // clickIconObj(Clone)用

    void Start()
    {
        SetNextSentence();
        events = FindObjectOfType <GodRoomHole>();
        events.MoveAnimation(a);
    }