public void Init() { foreach (Transform child in transform) { XffectComponent xft = child.GetComponent <XffectComponent>(); if (xft != null) { //make sure all children is inited. xft.Initialize(); if (!EffectDic.ContainsKey(child.name)) { EffectDic[child.name] = new List <XffectComponent>(); } EffectDic[child.name].Add(xft); } CompositeXffect cxft = child.GetComponent <CompositeXffect>(); if (cxft != null) { cxft.Initialize(); if (!CompEffectDic.ContainsKey(child.name)) { CompEffectDic[child.name] = new List <CompositeXffect>(); } CompEffectDic[child.name].Add(cxft); } } mInited = true; }
void RefreshDic() { EffectDic = new Dictionary <string, List <XffectComponent> >(); CompEffectDic = new Dictionary <string, List <CompositeXffect> >(); foreach (Transform child in transform) { XffectComponent xft = child.GetComponent <XffectComponent>(); if (xft != null) { if (!EffectDic.ContainsKey(child.name)) { EffectDic[child.name] = new List <XffectComponent>(); } EffectDic[child.name].Add(xft); } CompositeXffect cxft = child.GetComponent <CompositeXffect>(); if (cxft != null) { if (!CompEffectDic.ContainsKey(child.name)) { CompEffectDic[child.name] = new List <CompositeXffect>(); } CompEffectDic[child.name].Add(cxft); } } }
public void Reset() { foreach (Transform child in transform) { XffectComponent xft = child.GetComponent <XffectComponent>(); if (xft != null && xft.gameObject.activeSelf) { xft.DeActive(); } CompositeXffect cxft = child.GetComponent <CompositeXffect>(); if (cxft != null && cxft.gameObject.activeSelf) { cxft.DeActive(); } } }