Exemplo n.º 1
0
 protected virtual void CheckInterface()
 {
     if (null == character)
     {
         Debug.LogError("character not set");
     }
     if (null == loader)
     {
         loader = LChatacterRecourceLoader.Instance();
     }
 }
Exemplo n.º 2
0
 void CheckInterface()
 {
     if (null == charactor)
     {
         charactor = this;
     }
     if (null == loader)
     {
         loader = LChatacterRecourceLoader.Instance();
     }
 }
Exemplo n.º 3
0
 public abstract IEnumerator onInit(LChatacterRecourceInterface loader, LChatacterInterface character, AddCoroutineFun fun);
Exemplo n.º 4
0
 public override IEnumerator onInit(LChatacterRecourceInterface loader, LCharacterInterface character, AddCoroutineFun fun)
 {
     yield return(null);
 }
Exemplo n.º 5
0
    public override IEnumerator onInit(LChatacterRecourceInterface loader, LCharacterInterface character, AddCoroutineFun fun)
    {
        hasLoaded = false;
        CharactorLoadHandle handle0 = loader.LoadSkillDataFile(SkillId, fun);

        while (!handle0.isFinish)
        {
            yield return(null);
        }
        skillData = (LCHSkillData)handle0.asset;

        role.type  = 1;
        role.objId = -1;

        character.UpdateSkillRange(cdName, skillData.skillRange, skillData.skillWidth);
        //
        objs[role.objId] = role;
        objList          = new ObjectContain[skillData.objs.Length];
        for (int i = 0, l = skillData.objs.Length; i < l; i++)
        {
            var           o  = skillData.objs[i];
            ObjectContain oc = new ObjectContain();
            oc.SetInformation(o);
            objs[o.id] = oc;
            objList[i] = oc;
            if (o.id == -1)//不加载主模型。
            {
                continue;
            }
            else if (o.type == 1)//对象(特效,模型...)。
            {
                //Debug.LogError("load " + oc.mod);
                var handle = loader.loadResource(oc.mod_name, oc.mod, fun);
                while (!handle.isFinish)
                {
                    yield return(1);
                }
                if (null != handle.asset)
                {
                    if (handle.asset == null)
                    {
                        Debug.LogError("找不到资源,是否没打包 ? " + oc.mod);
                    }
                    else
                    {
                        oc.baseGameObject = (GameObject)handle.asset;
                        if (null != oc.baseGameObject)
                        {
                            oc.gameobject = GameObject.Instantiate(oc.baseGameObject);
                            oc.gameobject.SetActive(false);
                            oc.gameobject.name      = o.name;
                            oc.gameobject.hideFlags = HideFlags.None;
                            oc.systems = oc.gameobject.GetComponentsInChildren <ParticleSystem>();
                        }
                    }
                }
            }
            else if (o.type == 2)//(碰撞体)。
            {
                GameObject g = new GameObject();
                g.layer = character.GetAttackLayer();
                g.SetActive(false);
                g.AddComponent <BoxCollider>();
                g.hideFlags   = HideFlags.DontSave;
                oc.gameobject = g;
                g.name        = o.name;
            }
            else if (o.type == 3)//模型本身碰撞体。暂不连接。
            {
                continue;
            }
            else if (o.type == 4)//加载声音
            {
                GameObject g = new GameObject();
                g.name        = o.name;
                oc.gameobject = g;
                loader.loadResource(oc.mod_name, oc.mod, fun);
            }
        }
        for (int i = 0, c0 = skillData.events.Count; i < c0; i++)
        {
            var _e      = skillData.events[i];
            var contain = objs[_e.objId];
            contain.events.Add(_e);
        }

        for (int i = 0, c0 = skillData.channels.Count; i < c0; i++)
        {
            var _c      = skillData.channels[i];
            var contain = objs[_c.objId];
            contain.channels.Add(_c);
        }

        hasLoaded = true;
    }