예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (scale < 1.0f)
        {
            scale += SCALESPEED;
            if (scale >= 1.0f)
            {
                scale = 1.0f;
            }
            this.transform.localScale = new Vector3(scale, scale, scale);
            top.color    = new Vector4(theColor.r, theColor.g, theColor.b, scale * 0.85f);
            middle.color = new Vector4(theColor.r, theColor.g, theColor.b, scale * 0.85f);
            bottom.color = new Vector4(theColor.r, theColor.g, theColor.b, scale * 0.85f);
        }

        int numberOfCharactersToShow;

        shownStringLength += textSpeed;

        numberOfCharactersToShow = (int)shownStringLength;

        if (numberOfCharactersToShow >= text.Length)
        {
            numberOfCharactersToShow = text.Length;
            theText.text             = text;

            ++curAnswer;
            if (curAnswer == nAnswer)
            {
                finished = true;


                if ((theParent != null) && !touchToContinue)
                {
                    theParent.textHasFinishedRendering();                      // notify end of action

                    theParent = null;
                }
                if (touchToContinue && !finishOnce)
                {
                    touch.enabled = true;
                    elapsedTime   = 0.0f;
                    fNumber       = 0;
                    finishOnce    = true;
                }
            }
            else                 // game on, game on...
            {
                theText           = textArray[curAnswer];
                text              = answer [curAnswer];
                shownStringLength = 0.0f;
            }
        }
        else
        {
            theText.text = text.Substring(0, numberOfCharactersToShow);
        }


        if (finished && touchToContinue)
        {
            // show touch icon
            elapsedTime += Time.deltaTime;
            if (elapsedTime > 0.33f)
            {
                fNumber     = (fNumber + 1) % 2;
                elapsedTime = 0.0f;
                if (fNumber == 0)
                {
                    touch.sprite = touchImage_0;
                }
                if (fNumber == 1)
                {
                    touch.sprite = touchImage_1;
                }
            }

            if (Input.GetMouseButtonDown(0) && theParent != null)
            {
                theParent.textHasFinishedRendering();
                theParent     = null;
                touch.enabled = false;
            }
        }
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!renderingEnabled)
        {
            return;
        }

        LOOKATME = centerYPos - bubbleHeight + dialogueObject.maxScroll;
        if ((centerYPos - bubbleHeight + dialogueObject.maxScroll > 300.0f) && !isAnswerBlob && !readerMode)
        {
            disableRendering();
        }

        if (scale < 1.0f)
        {
            scale += SCALESPEED;
            if (scale >= 1.0f)
            {
                scale = 1.0f;
            }
            this.transform.localScale = new Vector3(scale, scale, scale);
            Vector4 col = new Vector4(theColor.r, theColor.g, theColor.b, scale * 0.85f);

            top.color         = col;
            middle.color      = col;
            bottom.color      = col;
            topLeft.color     = col;
            middleLeft.color  = col;
            bottomLeft.color  = col;
            topRight.color    = col;
            middleRight.color = col;
            bottomRight.color = col;
        }

        int numberOfCharactersToShow;

        shownStringLength += (textSpeed * textSpeedMultiplier);
        if (textSpeed == 0.0f)
        {
            shownStringLength = text.Length;
        }

        numberOfCharactersToShow = (int)shownStringLength;

        if (Input.GetMouseButtonDown(0))
        {
            textSpeedMultiplier = 4.0f;
        }

        if (numberOfCharactersToShow >= text.Length)
        {
            numberOfCharactersToShow = text.Length;
            theText.text             = text;
            finished = true;

            if ((theParent != null) && !touchToContinue)
            {
                if (!isAnswerBlob)
                {
                    theParent.textHasFinishedRendering();                      // notify end of action
                    theParent = null;
                }
            }
            if (touchToContinue && !finishOnce)
            {
                //touch.enabled = true;
                elapsedTime = 0.0f;
                fNumber     = 0;
                finishOnce  = true;
            }
        }
        else
        {
            theText.text = text.Substring(0, numberOfCharactersToShow);
        }


        if (finished && touchToContinue)
        {
            // show touch icon
            elapsedTime += Time.deltaTime;
            if (elapsedTime > 0.33f)
            {
                fNumber     = (fNumber + 1) % 2;
                elapsedTime = 0.0f;
                if (fNumber == 0)
                {
                    touch.sprite = touchImage_0;
                }
                if (fNumber == 1)
                {
                    touch.sprite = touchImage_1;
                }
            }

            if (Input.GetMouseButtonDown(0) && theParent != null)
            {
                if (!isAnswerBlob)
                {
                    theParent.textHasFinishedRendering();
                    theParent     = null;
                    touch.enabled = false;
                }
            }
        }
    }