Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     cParams        = new CoroutineParameters();
     cParams.active = false;
     moveCoroutine  = moveCam(cParams);
     audioSource    = this.GetComponent <AudioSource>();
 }
Ejemplo n.º 2
0
    IEnumerator updateWord(CoroutineParameters param, string openingTag, string closingTag, string text)
    {
        float timer = 0;

        UIText.text = UIText.text.Insert(charIndex, openingTag + closingTag);
        int wordIndex = 0;

        charIndex += openingTag.Length;
        string paragraph = UIText.text;

        while (wordIndex < text.Length)
        {
            timer += Time.deltaTime;
            if (timer > 1 / param.speed)
            {
                while (timer > 1 / param.speed)
                {
                    timer -= 1 / param.speed;
                    if (text[wordIndex] == '<' && text[wordIndex + 1] != '/')
                    {
                        string openingTag2 = "", textInside = "", closingTag2 = "";
                        getTag(wordIndex, text.ToCharArray(), ref openingTag2, ref closingTag2, ref textInside);
                        CoroutineParameters co = new CoroutineParameters(param.speed);
                        StartCoroutine(updateWord(co, openingTag2, closingTag2, textInside));
                        while (!co.finished)
                        {
                            yield return(null);
                        }
                        wordIndex += openingTag2.Length + closingTag2.Length + textInside.Length;
                        if (wordIndex >= text.Length)
                        {
                            break;
                        }
                    }
                    else
                    {
                        string s = "" + text[wordIndex];
                        paragraph   = paragraph.Insert(charIndex, s);
                        UIText.text = paragraph;
                        charIndex++;
                        wordIndex++;

                        if (wordIndex >= text.Length)
                        {
                            break;
                        }
                    }
                }
                yield return(null);
            }
            else
            {
                yield return(null);
            }
        }
        charIndex     += closingTag.Length;
        param.finished = true;
        yield break;
    }
Ejemplo n.º 3
0
    IEnumerator updateParagraph(CoroutineParameters param)
    {
        float  timer     = 0;
        string paragraph = "";

        char[] text = textList [index].ToCharArray();

        end            = false;
        UICursor.color = new Color(1, 1, 1, 0);
        charIndex      = 0;

        while (charIndex < text.Length)
        {
            timer += Time.deltaTime;
            if (timer > 1 / param.speed)
            {
                while (timer > 1 / param.speed)
                {
                    timer -= 1 / param.speed;

                    if (text[charIndex] == '<' && text[charIndex + 1] != '/')
                    {
                        string openingTag = "", textInside = "", closingTag = "";
                        getTag(charIndex, text, ref openingTag, ref closingTag, ref textInside);
                        CoroutineParameters co = new CoroutineParameters(param.speed);
                        StartCoroutine(updateWord(co, openingTag, closingTag, textInside));
                        while (!co.finished)
                        {
                            yield return(null);
                        }
                        paragraph = UIText.text;
                    }

                    string s = "" + text[charIndex];
                    paragraph   = paragraph.Insert(paragraph.Length, s);
                    UIText.text = paragraph;
                    charIndex++;

                    if (charIndex >= text.Length)
                    {
                        break;
                    }
                }
                yield return(null);
            }
            else
            {
                yield return(null);
            }
        }
        end            = true;
        UICursor.color = new Color(1, 1, 1, 1);
        yield break;
    }
Ejemplo n.º 4
0
    void Start()
    {
        animator = this.GetComponent <Animator> ();

        /* UIText.supportRichText = true;
         *       UIimage.color = new Color(1,1,1,0);
         * UIText.color = new Color(0,0, 0, 0);
         *       UICursor.color = new Color(1,1,1,0);*/
        UIPanneau.color = new Color(1, 1, 1, 0);
        param           = new CoroutineParameters(textSpeed);
        _audioSource    = this.GetComponent <AudioSource>();
    }
Ejemplo n.º 5
0
 //coroutine pour gerer le deplacement
 IEnumerator updatePosition(CoroutineParameters param)
 {
     while (true)
     {
         if (param.active && this.transform.position != param.position)
         {
             newPosition.x           = Mathf.SmoothDamp(this.transform.position.x, param.position.x, ref xVelocity, param.speed);
             newPosition.y           = Mathf.SmoothDamp(this.transform.position.y, param.position.y, ref yVelocity, param.speed);
             newPosition.z           = Mathf.SmoothDamp(this.transform.position.z, param.position.z, ref zVelocity, param.speed);
             this.transform.position = newPosition;
             yield return(null);
         }
         yield return(null);
     }
 }
Ejemplo n.º 6
0
    void Start()
    {
        //sauvegarde de la postion orignal
        originalPosition = this.transform.position;

        //initialisation des variables pour les coroutines
        nextPosition = this.transform.position;

        next = nextPosition;

        cParams          = new CoroutineParameters();
        cParams.position = nextPosition;
        cParams.speed    = moveSmoothTime;

        //initialisation des coroutines
        //moveCoroutine = updatePosition (cParams);
        //StartCoroutine (moveCoroutine);
    }
Ejemplo n.º 7
0
    IEnumerator moveCam(CoroutineParameters param)
    {
        while (true)
        {
            if (GameObject.Find("Character").transform.position.x == this.transform.position.x)
            {
                param.active = true;
            }

            if (param.active == true)
            {
                GameObject.Find("Pantalone").GetComponent <Animator>().SetTrigger("angry");

                this.GetComponent <Animator> ().SetTrigger("roll");
                audioSource.Play();
                GameObject.Find("Public").GetComponent <PublicScript>().happy(1.5f, 0.7f);
                GameObject.Find("Jauge_circulaire").GetComponent <JaugeScript>().add(35.254564f);
                yield break;
            }
            yield return(null);
        }
    }