summaryrefslogtreecommitdiff
path: root/Assets/Test/08_Button/UI08Button.cs
blob: ec9f992375b35775a577141bdf959596e8a781c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using UnityEngine;
using System;
using System.Collections;


public class UI08Button : MonoBehaviour
{
    private void Start()
    {
        StartCoroutine(Speak());
    }

    void Update()
    {
    }

    IEnumerator Wait5Sec()
    {
        Debug.Log("Wait for 5 sec");
        yield return new WaitForSeconds(5);
        Debug.Log("Wait for 5 sec done");
    }

    IEnumerator Speak()
    {
        int i = -1;
        while (true)
        {
            Debug.Log("wait 1 sec" + (++i));
            yield return new WaitForSeconds(1);
            yield return StartCoroutine(Wait5Sec());
            Debug.Log("wait 2 sec" + (++i));
            yield return new WaitForSeconds(2);
            Debug.Log("wait 3 sec" + (++i));
            yield return new WaitForSeconds(3);
        }
    }

}