using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; public class Allother : MonoBehaviour { public List otherWonius=new List(); public List House;//蜗牛进入的父物体 public GameObject OtherWoniuPre;//其他蜗牛预制体 // Start is called before the first frame update void Start() { //ControWoniuToMove(); //StartCoroutine(WoniuToMove()); } //public IEnumerator WoniuToMove() //{ // CreateWoniu();//创建蜗牛 //} //public async void ControWoniuToMove() // { // foreach (otherWoniu item in otherWonius) // { // await Task.Delay(1000); // item.OtherWoniuMove(); // } // } //蜗牛全部刷新到笼子里面 public void RefrashAllWoniu() { } public void CreateWoniu() { foreach (HouseBtn house in House) { for (int i = 0; i < house.roomUserNo; i++) { GameObject ot=Instantiate(OtherWoniuPre, transform); otherWonius.Add(ot.GetComponent()); ot.GetComponent().OtherWoniuMove(house.roomNo);//进房间 } } } }