public void Despawn(U3DObject uobj) { if (spwanList.Contains(uobj)) { U3DMod.AddChild(null, uobj.gameObject, true); uobj.Hide(); spwanList.Remove(uobj); despawnList.Add(uobj); } }
public void OnDestroy(U3DObject uobj) { if (spwanList.Contains(uobj)) { spwanList.Remove(uobj); } if (despawnList.Contains(uobj)) { despawnList.Remove(uobj); } }
public U3DObject SpawnOne() { U3DObject uobj = null; if (despawnList.Count > 0) { spwanList.Add(despawnList[0]); uobj = despawnList[0]; despawnList.Remove(uobj); uobj.DespawnHandler = Despawn; uobj.OnDestroyHandler = OnDestroy; } else if (spwanList.Count > 0) { uobj = U3DMod.Clone <U3DObject>(spwanList[0]); spwanList.Add(uobj); uobj.DespawnHandler = Despawn; uobj.OnDestroyHandler = OnDestroy; } return(uobj); }
public List <U3DObject> despawnList; //池内元素 public U3dCache(U3DObject uobj) { spwanList = new List <U3DObject>(); despawnList = new List <U3DObject>(); despawnList.Add(uobj); }