示例#1
0
    void Start()
    {
        plantList = new List<GameObject>();
        mainTreeLeaves = GameObject.Find("Main Tree Leaves");
        treeScript = mainTreeLeaves.GetComponent<MainTreeLeavesScript>();
        Vector3 treeLeavesPos = mainTreeLeaves.transform.position;

        for (int i = 0; i < startInsects; i++) {
            Vector3 spawnPoint = new Vector3 (
                treeLeavesPos.x + Random.Range(-randPosRange, randPosRange),
                treeLeavesPos.y + Random.Range(-randPosRange, randPosRange),
                treeLeavesPos.z + Random.Range(-randPosRange, randPosRange));
            Instantiate(insect, spawnPoint, Quaternion.identity);
        }
    }
示例#2
0
    void Start()
    {
        plantList      = new List <GameObject>();
        mainTreeLeaves = GameObject.Find("Main Tree Leaves");
        treeScript     = mainTreeLeaves.GetComponent <MainTreeLeavesScript>();
        Vector3 treeLeavesPos = mainTreeLeaves.transform.position;

        for (int i = 0; i < startInsects; i++)
        {
            Vector3 spawnPoint = new Vector3(
                treeLeavesPos.x + Random.Range(-randPosRange, randPosRange),
                treeLeavesPos.y + Random.Range(-randPosRange, randPosRange),
                treeLeavesPos.z + Random.Range(-randPosRange, randPosRange));
            Instantiate(insect, spawnPoint, Quaternion.identity);
        }
    }