Exemplo n.º 1
0
        public void dispose()
        {
            if (m_controlRes != null)
            {
                Ctx.m_instance.m_controllerMgr.unload(m_controlRes.GetPath(), null);
                m_controlRes = null;
            }

            if(m_animator != null)
            {
                UtilApi.Destroy(m_animator.runtimeAnimatorController);
            }

            if(m_nextFrametimer != null)
            {
                Ctx.m_instance.m_frameTimerMgr.delObject(m_nextFrametimer);
                m_nextFrametimer = null;
            }
            if (m_idleStateFrametimer != null)
            {
                Ctx.m_instance.m_frameTimerMgr.delObject(m_idleStateFrametimer);
                m_idleStateFrametimer = null;
            }
            if (m_oneAniEndTimer != null)
            {
                Ctx.m_instance.m_timerMgr.delObject(m_oneAniEndTimer);
                m_oneAniEndTimer = null;
            }

            m_oneAniPlayEndDisp.clearEventHandle();
        }
Exemplo n.º 2
0
        // 同步更新控制器
        public void syncUpdateControl()
        {
            if (m_bNeedReload)
            {
                if (m_controlRes != null)
                {
                    Ctx.m_instance.m_controllerMgr.unload(m_controlRes.GetPath(), null);
                    m_controlRes = null;

                    if (m_animator != null)
                    {
                        UtilApi.Destroy(m_animator.runtimeAnimatorController);
                    }
                }

                m_controlRes = Ctx.m_instance.m_controllerMgr.getAndSyncLoad<ControllerRes>(m_controlPath);
            }
            if (m_selfGoChanged)
            {
                UtilApi.AddAnimatorComponent(m_selfGo);
                m_animator = m_selfGo.GetComponent<Animator>();
            }

            if (m_bNeedReload || m_selfGoChanged)
            {
                m_animator.runtimeAnimatorController = m_controlRes.InstantiateController();

                if(m_stateValue == 0 && canStopIdleFrameTimer())       // 如果当前在 Idle 状态,并且已经完成到 Idle 状态的切换
                {
                    m_animator.enabled = false;
                }
            }

            m_bNeedReload = false;
            m_selfGoChanged = false;
        }