Exemplo n.º 1
0
    private static IEnumerator AsyncLoadModel(ObjectModel model)
    {
        yield return(null);

        AsyncLoadRequest request;


        if (!string.IsNullOrEmpty(model.ModelCfg.ModelPath))
        {
            request = XYSingleAssetLoader.AsyncLoad(model.ModelCfg.ModelPath, null, null);
            while (!request.isDone)
            {
                yield return(null);
            }
            model.GameObject      = request.asset as GameObject;
            model.GameObject.name = model.ModelCfg.EquipName;
        }

        //特效
        foreach (EffectConfig effectInfo in model.ModelCfg.Effects.Where(effectInfo => !string.IsNullOrEmpty(effectInfo.EffectAssetPath)))
        {
            request = XYSingleAssetLoader.AsyncLoad(effectInfo.EffectAssetPath, null, null);
            while (!request.isDone)
            {
                yield return(null);
            }
            model.EffectObjects.Add(request.asset as GameObject);
        }
        model.LoadOver();
    }