示例#1
0
    IEnumerator spawner()
    {
        while (true)
        {
            var routine = StartCoroutine(in5());
            yield return(new WaitUntil(() =>
                                       !ball.active || ball.transform.position.y < -5 || respawn_in_5));

            respawn_in_5 = false;
            StopCoroutine(routine);
            if (!ball.active)
            {
                boardIn.AddListenerOneTime(_ => SpawnABall());
            }
            else
            {
                yield return(new WaitForSeconds(.25f));

                SpawnABall();
            }
            yield return(null);
        }
    }