private void ShowEffectComponent(EffectsComponent effectsComponent) { GameObject gameClip = EditorGUILayout.ObjectField(effectsComponent.gameClip, typeof(GameObject), false) as GameObject; if (effectsComponent.gameClip != gameClip) { effectsComponent.SetGameClip(gameClip); } }
private void LoadAllSkill() { string path = "Assets/" + gameObject.name + ".txt"; if (File.Exists(path)) { string str = File.ReadAllText(path); List <SkillJson> skills = JsonConvert.DeserializeObject <List <SkillJson> >(str); //遍历解析出来的Json列表 foreach (var item in skills) { //根据item的技能名字来加上技能列表 skillsList.Add(item.name, new List <ComponentBase>()); //遍历对应名字的技能列表 foreach (var ite in item.skills) { //遍历每个技能的属性 foreach (var it in ite.Value) { if (ite.Key.Equals("动画")) { AnimationClip clip = AssetDatabase.LoadAssetAtPath <AnimationClip>("Assets/GameDate/Anim/" + it + ".anim"); print("++++++++" + "Assets/GameDate/Anim/" + it + ".anim"); AnimComponent _anim = new AnimComponent(this); _anim.SetAnimClip(clip); print(clip); skillsList[item.name].Add(_anim); } else if (ite.Key.Equals("音效")) { AudioClip clip = AssetDatabase.LoadAssetAtPath <AudioClip>("Assets/GameDate/Audio/" + it + ".mp3"); AudioComponent _audio = new AudioComponent(this); _audio.SetAudioClip(clip); skillsList[item.name].Add(_audio); } else if (ite.Key.Equals("特效")) { GameObject clip = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/GameDate/Effect/Skill/" + it + ".prefab"); EffectsComponent _effect = new EffectsComponent(this); _effect.SetGameClip(clip); skillsList[item.name].Add(_effect); } } } } } }