private CoroutineCore GetCoroutineCore(string coreName) { CoroutineCore curCC = null; _cores.TryGetValue(coreName, out curCC); return(curCC); }
public void DestroyCoroutineCore(string coreName) { if (_cores.ContainsKey(coreName)) { CoroutineCore curCore = _cores[coreName]; curCore.StopAllCoroutines(); GameObject.DestroyImmediate(curCore.gameObject); } }
public void Initialize(GameObject mainObj) { if (null == mainObj) { Engine.Utility.Log.Error("CoroutineMgr Initialize Failed, MainObject not found!"); return; } core = mainObj.AddComponent <CoroutineCore>(); }
public void StopALLCoroutines(string coreName) { CoroutineCore curCore = GetCoroutineCore(coreName); if (curCore != null) { curCore.StopAllCoroutines(); } else { BaseLogger.Error("Not have this coreName:{0}", coreName); } }
public void StopCoroutine(string coreName, IEnumerator routine) { CoroutineCore curCore = GetCoroutineCore(coreName); if (curCore != null) { curCore.StopCoroutine(routine); } else { BaseLogger.Error("you stopCoroutine with error coreName:{0}", coreName); } }
private CoroutineCore GetOrCreateCoroutineCore(string coreName) { CoroutineCore curCore = GetCoroutineCore(coreName); if (curCore != null) { } else { curCore = CreateCoroutineCore(coreName); } return(curCore); }
private CoroutineCore CreateCoroutineCore(string coreName) { GameObject curCoreObj = new GameObject(coreName); curCoreObj.transform.parent = _coroutineHelperObj.transform; #if UNITY_5 || UNITY_2017 #else UnityEngine.Object.DontDestroyOnLoad(curCoreObj); #endif CoroutineCore curCore = curCoreObj.AddComponent <CoroutineCore>(); _cores.Add(coreName, curCore); return(curCore); }
public Coroutine StartCoroutine(string coreName, IEnumerator routine) { CoroutineCore curCore = GetOrCreateCoroutineCore(coreName); return(curCore.StartCoroutine(routine)); }