Пример #1
0
        private CoroutineCore GetCoroutineCore(string coreName)
        {
            CoroutineCore curCC = null;

            _cores.TryGetValue(coreName, out curCC);
            return(curCC);
        }
Пример #2
0
 public void DestroyCoroutineCore(string coreName)
 {
     if (_cores.ContainsKey(coreName))
     {
         CoroutineCore curCore = _cores[coreName];
         curCore.StopAllCoroutines();
         GameObject.DestroyImmediate(curCore.gameObject);
     }
 }
Пример #3
0
 public void Initialize(GameObject mainObj)
 {
     if (null == mainObj)
     {
         Engine.Utility.Log.Error("CoroutineMgr Initialize Failed, MainObject not found!");
         return;
     }
     core = mainObj.AddComponent <CoroutineCore>();
 }
Пример #4
0
        public void StopALLCoroutines(string coreName)
        {
            CoroutineCore curCore = GetCoroutineCore(coreName);

            if (curCore != null)
            {
                curCore.StopAllCoroutines();
            }
            else
            {
                BaseLogger.Error("Not have this coreName:{0}", coreName);
            }
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
        private CoroutineCore GetOrCreateCoroutineCore(string coreName)
        {
            CoroutineCore curCore = GetCoroutineCore(coreName);

            if (curCore != null)
            {
            }
            else
            {
                curCore = CreateCoroutineCore(coreName);
            }
            return(curCore);
        }
Пример #7
0
        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);
        }
Пример #8
0
        public Coroutine StartCoroutine(string coreName, IEnumerator routine)
        {
            CoroutineCore curCore = GetOrCreateCoroutineCore(coreName);

            return(curCore.StartCoroutine(routine));
        }