public void Begin(string path, bool autoDestory) { m_bAutoDestory = autoDestory; m_sPath = path; this.name = path; m_fDuration = 0; m_bDestory = false; m_cEffectInfo = null; ResourceObjectPool.Instance.GetObject(m_sPath, false, OnLoadResource); }
private void OnLoadResource(GameObject go) { this.gameObject.AddChildToParent(go); m_cEffectInfo = go.AddComponentOnce <EffectInfo>(); m_fDuration = m_cEffectInfo.duration; if (m_bAutoDestory) { m_fDestoryTime = m_fDuration; } else { m_fDestoryTime = 0; } }
public void End() { m_fDestoryTime = 0; m_bDestory = true; if (!string.IsNullOrEmpty(m_sPath)) { ResourceObjectPool.Instance.RemoveCallback(m_sPath, OnLoadResource); } if (m_cEffectInfo != null) { ResourceObjectPool.Instance.SaveObject(m_sPath, m_cEffectInfo.gameObject); m_cEffectInfo = null; } m_sPath = null; }
private void OnLoadResource(string path, UnityEngine.Object obj) { GameObject go = (GameObject)obj; this.gameObject.AddChildToParent(go); m_cEffectInfo = go.AddComponentOnce <EffectInfo>(); m_fDuration = m_cEffectInfo.duration; if (m_bAutoDestory) { m_fDestoryTime = m_fDuration; } else { m_fDestoryTime = 0; } }