Esempio n. 1
0
    IEnumerator spawnMoreBunnies(float interval)
    {
        while (true)
        {
            Vector3 pos = Random.insideUnitSphere * radius;
            pos.y = 10.0f;
            Bunny bunny = GenerateBunny(pos);

            Rigidbody rb = bunny.GetComponent <Rigidbody>();
            pos.y = 0.0f;
            rb.AddForce(-pos * 50f);

            yield return(new WaitForSeconds(interval));
        }
    }