Example #1
0
    public void OnLoadObjCallback(Object target, string path)
    {
        EquipType type;

        if (!GetCurTypeByLoadingIndex(out type))
        {
            return;
        }

        if (!modelPartPath.ContainsKey(type) || !modelPartPath[type].Equals(path))
        {
            return;
        }
        GameObject prefab = target as GameObject;

        if (null == prefab)
        {
            Debug.LogError("Model Asset is null!!!:" + path);
            return;
        }
        GameObject go = GameObject.Instantiate(prefab, modelParent);

        if (type == EquipType.Main)
        {
            model    = go;
            animator = AnimationBase.GetAnimationBase(animationType, go);
            OnModelChange(go);
        }
        else
        {
            Transform tempParent = model.transform.Find(CharaDefine.CharaPartParent[type]);
            if (tempParent != null)
            {
                go.transform.SetParent(tempParent);
                go.transform.localPosition    = Vector3.zero;
                go.transform.localEulerAngles = Vector3.zero;
                go.transform.localScale       = Vector3.one;
            }
        }

        SetParObj(type, go);
    }
Example #2
0
    public override void CreateModel(string path, Transform parent, int type)
    {
        if (null != animator)
        {
            model.SetActive(true);
            return;
        }

        AssetManager.LoadAsset(path, (Object target, string comePath) =>
        {
            GameObject prefab = target as GameObject;
            if (null != prefab)
            {
                GameObject go = GameObject.Instantiate(prefab, parent);
                model         = go;
                animator      = AnimationBase.GetAnimationBase(type, go);
                ChangeTranslucence(0);
            }
        });
    }