public void Init <T, U>(T caster, U target, SkillData skillData, VarVector3 effectpos = null, SkillComplate complate = null) where T : PlayerBase where U : PlayerBase { this.Target = target; this.Caster = caster; this.SkillData = skillData; this.m_Complate = complate; this.m_EffectPos = effectpos; }
/// <summary> /// 技能的合法性验证, 通过TrigSkill返回触发的技能 /// </summary> /// <param name="skillId"></param> /// <param name="caster">施法者</param> /// <param name="target">目标</param> /// <param name="trig">技能触发</param> /// <param name="effectpos">特效位置</param> /// <param name="complate">技能完成回掉</param> public void Verify(int skillId, PlayerBase caster, PlayerBase target, TrigSkill trig, VarVector3 effectpos, SkillComplate complate) { //查阅技能 if (!m_Skills.ContainsKey(skillId)) { throw new KeyNotFoundException(string.Format("{0} 不在技能表", skillId)); } SkillData skilldata = m_Skills[skillId]; //使用技能属性初始化技能[这里后续使用对象池获取对象,暂时直接new] Skill skill = new Skill(); skill.Init(caster, target, skilldata, effectpos, complate); //检查释放条件 //蓝耗检查 if (skilldata.SpendMP > 0) { if (!skill.IsValid(new MpVerify())) { trig(null); return; } } //to-do其他检查 trig(skill); }