Exemplo n.º 1
0
        private IEffect CreateObj()
        {
            var o = GameObject.Instantiate(obj);

            o.transform.SetParent(EffectManager.parent);
            IEffect i   = null;
            var     arr = o.GetComponents <MonoBehaviour>();

            for (int a = 0; a < arr.Length; a++)
            {
                if (arr[a] is IEffect)
                {
                    i = arr[a] as IEffect;
                    break;
                }
            }
            if (i == null)
            {
                i = o.AddComponent <EffectControl>() as IEffect;
                Log.i(ELogType.Error, "特效表中配为Sub(1)方阵特效,prefab上却是普通特效===>  " + index);
            }
            pauseHandler  = i.OnPause;
            resumeHandler = i.OnResume;
            i.index       = index;
            i.group       = group;
            i.Create();
#if UNITY_EDITOR
            allList.Add(i);
#endif
            return(i);
        }