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; }
public XffectComponent AddXffect(string name) { Transform baseobj = transform.Find(name); if (baseobj == null) { Debug.Log("object:" + name + "doesn't exist!"); return(null); } Transform newobj = Instantiate(baseobj, Vector3.zero, Quaternion.identity) as Transform; newobj.parent = transform; XffectComponent.SetActive(newobj.gameObject, false); newobj.gameObject.name = baseobj.gameObject.name; XffectComponent xft = newobj.GetComponent <XffectComponent>(); EffectDic[name].Add(xft); if (xft != null) { xft.Initialize(); } return(xft); }
void Awake() { m_instance = this; 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 ArrayList(); } EffectDic[child.name].Add(xft); } CompositeXffect cxft = child.GetComponent <CompositeXffect>(); if (cxft != null) { cxft.Initialize(); if (!CompEffectDic.ContainsKey(child.name)) { CompEffectDic[child.name] = new ArrayList(); } CompEffectDic[child.name].Add(cxft); } } }
void Start() { //pre init here to avoid lag. QuadExplode.Initialize(); SphericalExplode.Initialize(); QuadFogs.Initialize(); SphericalFogs.Initialize(); }
//pre-init xffect objs to avoid lags when they get activated. void Start() { explode_energy.Initialize(); ice_impact.Initialize(); suckblood.Initialize(); firestorm.Initialize(); phantomsword.Initialize(); cyclonestorm.Initialize(); radial_energy.Initialize(); lightning_storm.Initialize(); glow_per_obj.Initialize(); }
void Start() { foreach (Transform child in transform) { XffectComponent xft = child.GetComponent <XffectComponent>(); if (xft == null) { continue; } xft.Initialize(); XffectList.Add(xft); } }
public void Initialize() { //already initialized if (XffectList.Count > 0) { return; } foreach (Transform child in transform) { XffectComponent xft = child.GetComponent <XffectComponent>(); if (xft == null) { continue; } xft.Initialize(); XffectList.Add(xft); } }
void Start() { YourEffect.Initialize(); }