Exemplo n.º 1
0
    IEnumerator Start_Normal(float time, float overtime, float delaytime)
    {
        float value_time     = 0;
        float value_overtime = 0;

        Vector3[] s = new Vector3[Awards.Length];
        Vector3[] e = new Vector3[Awards.Length];

        //盤面移到上面
        for (int i = 0; i < Awards.Length; i++)
        {
            s[i] = pos[i] + new Vector3(0, height, 0);
            e[i] = pos[i];
            Awards[i].transform.localPosition = s[i];
        }

        yield return(new WaitForSeconds(delaytime));

        while (true)
        {
            switch (Type)
            {
            case REELTYPE.NONE:
            {
                running = false;
                yield break;
            }

            case REELTYPE.START:
            {
                while (value_time <= time)
                {
                    value_time += Time.deltaTime;
                    yield return(null);
                }
                Type = REELTYPE.OVER;
            }
            break;

            case REELTYPE.OVER:
            {
                while (value_overtime <= overtime)
                {
                    value_overtime += Time.deltaTime;
                    float t = value_overtime / overtime;
                    for (int i = 0; i < Awards.Length; i++)
                    {
                        Awards[i].transform.localPosition = Vector3.Lerp(s[i], e[i], t);
                    }

                    yield return(null);
                }

                Type = REELTYPE.NONE;
            }
            break;
            }
        }
    }
Exemplo n.º 2
0
 public void StartGame_Normal(float time, float overtime, float delaytime)
 {
     running = true;
     Type    = REELTYPE.START;
     StartCoroutine(Start_Normal(time, overtime, delaytime));
 }