コード例 #1
0
    void OnDisable()
    {
        if (m_isApplicationQuit)
        {
            return;
        }
        Stop();
#if UNITY_EDITOR
        //如果是编辑器没有运行查看要手动调用下FxDestroy的update
        if (Application.isEditor && !Application.isPlaying)
        {
            FxDestroy fxDestroy = this.GetComponent <FxDestroy>();
            if (fxDestroy != null)
            {
                fxDestroy.Invoke("OnDisable", 0);
            }
        }
#endif
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        //判断下结束
        if (m_isPlaying && m_destroyTime != -1 && Util.time > m_destroyTime)
        {
            FxDestroy.DoDestroy(this.gameObject, false);
            m_destroyTime = -1;
        }

#if UNITY_EDITOR
        //如果是编辑器没有运行查看要手动调用下FxDestroy的update
        if (m_isPlaying && Application.isEditor && !Application.isPlaying)
        {
            FxDestroy fxDestroy = this.GetComponent <FxDestroy>();
            if (fxDestroy != null)
            {
                fxDestroy.Invoke("Update", 0);
            }
        }
#endif
    }
コード例 #3
0
    void OnEnable()
    {
#if UNITY_EDITOR
        //如果是编辑器没有运行查看要手动调用下FxDestroy的update
        if (Application.isEditor && !Application.isPlaying)
        {
            FxDestroy fxDestroy = this.GetComponent <FxDestroy>();
            if (fxDestroy != null)
            {
                fxDestroy.Invoke("OnEnable", 0);
            }
        }
#endif


        //判断IsPreloading是因为对象池预加载的时候不需要play
        if (!GameObjectPool.IsPreloading() && !m_isPlaying)
        {
            Play();
        }
    }