Пример #1
0
    public void CleanByScene()
    {
        //Debug.Log("Assembler.Clean ");

        mCorout_isRunning = false;

        this.StopCoroutine("LoadCoroutine");

        //StopAllCoroutines();

        foreach (var gameObj in m_Objects.Values)
        {
            GameObject go = (GameObject)gameObj;
            if (go != null)
            {
                go.SetActive(true);
                UnityEngine.Object.DestroyImmediate(go);
                go = null;
            }
        }
        m_Objects.Clear();

        foreach (CharacterLoader item in s_CharacterLoaders.Values)
        {
            CharacterLoader loader = (CharacterLoader)item;
            loader.Dispose();
            loader = null;
        }
        s_CharacterLoaders.Clear();

        foreach (ModelLoader item in s_ModelLoaders.Values)
        {
            ModelLoader loader = (ModelLoader)item;
            loader.Dispose();
            loader = null;
        }
        s_ModelLoaders.Clear();

        foreach (CharacterElementLoader item in s_CharacterElementLoaders.Values)
        {
            CharacterElementLoader loader = (CharacterElementLoader)item;
            loader.Dispose();
            loader = null;
        }
        s_CharacterElementLoaders.Clear();

        foreach (AnimationLoader item in s_AnimationAssemblers.Values)
        {
            AnimationLoader loader = (AnimationLoader)item;
            loader.Dispose();
            loader = null;
        }
        s_AnimationAssemblers.Clear();

        foreach (var item in m_Assemblers.Values)
        {
            AssemblerInfo loader = (AssemblerInfo)item;
            loader = null;
        }
        m_Assemblers.Clear();

        mUniqueID = 1;

        OnFinishLoading = null;
    }