Exemple #1
0
        protected void testScriptController()
        {
            string                    path    = string.Format("{0}{1}", Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathSceneAnimatorController], "SelfCardAni.asset");
            ControllerRes             res     = Ctx.m_instance.m_controllerMgr.getAndSyncLoad <ControllerRes>(path);
            RuntimeAnimatorController copyCom = res.InstantiateController();

            res.DestroyControllerInstance(copyCom);
            Ctx.m_instance.m_controllerMgr.unload(res.GetPath(), null);
        }
Exemple #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;
        }