|
- void RandomPig()
- {
- GameObject[] holeObjs = GameObject.FindGameObjectsWithTag("Hole");
- int i=Random.Range(0,holeObjs.Length);
- Object clonePig=Instantiate(pigObj,new Vector3(holeObjs[i].transform.position.x-0.9f,holeObjs[i].transform.position.y,2.1f),holeObjs[i].transform.rotation);
- GameObject [] pigObjs=GameObject.FindGameObjectsWithTag("Pig");
- int j=Random.Range(0,i);
- if(pigObjs.Length<=2)
- {
- Object clonePig1=Instantiate(pigObj,new Vector3(holeObjs[j].transform.position.x-0.9f,holeObjs[j].transform.position.y,2.1f),holeObjs[j].transform.rotation);
- }
- }
复制代码 随机实例化总场景不超过二个猪的二个猪 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|