/// <summary> /// 通过技能ID获取技能实例 /// </summary> /// <param name="skillId"></param> /// <returns></returns> public SkillBase GetSkillById(int skillId) { if (SkillObjMap == null || SkillObjMap.Count == 0) { Debug.Log("没有可用技能:" + role.Id); return(null); } if (!SkillObjMap.ContainsKey(skillId)) { Debug.Log("该技" + skillId + "尚未学会:" + role.Id); return(null); } return(SkillObjMap[skillId]); }
public void InitSkillMap(Dictionary <int, int> map) { SkillAllRemove(); if (map == null || map.Count == 0) { Debug.LogError("技能列表加载失败"); return; } foreach (int skillId in map.Keys) { SkillBase skill = SkillManager.Instance.GetSkillById(skillId); if (skill != null) { skill.SkillInit(role); //Debug.Log("技能对象字典初始化:" + skill.GetName()); SkillObjMap.Add(skill.GetId(), skill); } else { Debug.LogError("加载技能模板失败"); } } }