private MWB_Path createNewSubPath() { var subPath = new MWB_SubPath(); //Instantiate(SubPathInstance, Vector3.zero, Quaternion.identity, this.transform); subPath.Init(); m_SubPathsPool.Add(subPath); return(subPath); }
public MWB_SubPath GetSubPath(MWB_Path parentPath) { foreach (MWB_SubPath path in m_SubPathsPool) { if (path.IsInitialized) { path.Use(); path.SetParentPath(parentPath); return(path); } } for (int i = 0; i < SpawnLimitPerFrame; i++) { createNewSubPath(); } MWB_SubPath ret = m_SubPathsPool[m_SubPathsPool.Count - 1]; ret.Use(); ret.SetParentPath(parentPath); return(ret); }