private bool InitBaker(string[] paths, MB3_TextureBaker textureBaker, MB3_MeshBaker meshBaker)
    {
        bool result = false;

        Material material = ResourcesManagerMediator.
                            GetNoGameObjectFromResourcesManager <Material>(paths[1]);

        if (material == null)
        {
            Debug.LogError("加载合并材质资源失败" + paths[1]);
            return(result);
        }

        MB2_TextureBakeResults textureBakeResults = ResourcesManagerMediator.
                                                    GetNoGameObjectFromResourcesManager <MB2_TextureBakeResults>(paths[2]);

        if (textureBakeResults == null)
        {
            Debug.LogError("加载MB2_TextureBakeResults资源失败" + paths[2]);
            return(result);
        }

        textureBaker.resultMaterial     = material;
        textureBaker.textureBakeResults = textureBakeResults;
        meshBaker.textureBakeResults    = textureBakeResults;

        result = true;
        return(result);
    }
    /// <summary>
    /// </summary>
    /// <param name="path">
    /// path[0] meshbaker生成器资源路径
    /// path[1] meshbaker材质资源路径
    /// path[2] meshbaker贴图资源路径
    /// path[3] meshbaker合并对象资源路径
    /// </param>
    /// <param name="type"></param>
    /// <param name="count"></param>
    public CharObjCreator(string[] paths, BattleObjManager.E_BATTLE_OBJECT_TYPE type, int count)
    {
        bool retCode = false;

        m_meshbakerGo = ResourcesManagerMediator.
                        GetGameObjectFromResourcesManager(paths[0]);
        if (m_meshbakerGo == null)
        {
            Debug.LogError("加载baker生成器资源出错" + paths[0]);
            return;
        }

        MB3_TextureBaker textureBaker = m_meshbakerGo.GetComponent <MB3_TextureBaker>();

        m_meshBaker = m_meshbakerGo.GetComponentInChildren <MB3_MeshBaker>();

        retCode = InitBaker(paths, textureBaker, m_meshBaker);
        if (!retCode)
        {
            Debug.LogError("MeshBaker初始化失败");
            return;
        }

        m_seed = ResourcesManagerMediator.GetGameObjectFromResourcesManager(paths[3]);
        if (m_seed == null)
        {
            Debug.LogError("加载种子资源失败 " + paths[3]);
            return;
        }
        m_seed.transform.position = INIT_POS;

        m_count = count;
    }
Esempio n. 3
0
    public QObjCreatorForGameObject(string path, int count)
    {
        m_seed = ResourcesManagerMediator.GetGameObjectFromResourcesManager(path);
        if (m_seed == null)
        {
            Debug.LogWarning("读取种子资源出错 " + path);
            return;
        }

        m_seed.transform.position = INIT_POS;

        m_path  = path;
        m_count = count;
        isInit  = true;
    }