public Coroutine StartTrackedCoroutine(IEnumerator routine) { var tc = new TrackedCoroutine(routine); _tcSet.Add(tc); tc.onComplete += RemoveTC; tc.coroutine = base.StartCoroutine(tc); return(tc.coroutine); }
public void StopTrackedCoroutine(IEnumerator routine) { TrackedCoroutine tc = null; foreach (var temp in _tcSet) { if (temp.trackedCoroutine == routine) { tc = temp; break; } } if (tc != null) { RemoveTC(tc); base.StopCoroutine(routine); } }
public void StopTrackedCoroutine(Coroutine routine) { TrackedCoroutine tc = null; foreach (var temp in _tcSet) { if (temp.coroutine == routine) { tc = temp; break; } } if (tc != null) { RemoveTC(tc); if (null != this) { base.StopCoroutine(routine); } } }
private void RemoveTC(TrackedCoroutine tc) { tc.onComplete -= RemoveTC; _tcSet.Remove(tc); DestroyIfEmpty(); }