Пример #1
0
    IEnumerator CreateBasicCow()
    {
        while (true)
        {
            var newCowObject = Instantiate(basicCow, getRandomPoint(), transform.rotation);
            newCowObject.transform.parent = GameObject.Find("Cows").transform;
            Cow newCow = newCowObject.GetComponent <Cow> ();
            if (newCow.CheckOverlap())
            {
                Debug.Log("Collision detected from this script, " + newCow.name);
                Destroy(newCowObject);
                continue;
            }

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