public PipeGroup CreatePipeGroup() { var pipeGroup = pipeGroupPool.FirstOrDefault(p => p.Idle); if (pipeGroup == null) { //如果没有闲置的,就加载预制创建 PipeGroup newPipeGroup = new PipeGroup(); pipeGroupPool.Add(newPipeGroup); Debug.Log("池中没有闲置管子,去创建管子"); newPipeGroup.GenratePipeGroup(RandomAdjustPipeGroupPos()); count++; return(newPipeGroup); } else { Debug.Log("池中有闲置管子,初始化位置即可"); pipeGroup.GenratePipeGroup(RandomAdjustPipeGroupPos()); return(pipeGroup); } }