// 计算公式值 public float CalcFormula(IObject obj, string formula) { if (!CheckFormula(formula) || obj == null) { return(0.00f); } if (!m_formulaParser.ContainsKey(formula)) { FormulaParserManager.Instance.RegistFormula(formula); //return 0.00f; } FormulaParser formulaParser = m_formulaParser[formula]; formulaParser.SetSelfObj(obj); return(formulaParser.Value()); }
// 计算战斗相关公式 public float CalcSkillFormula(IObject self, IObject selfSkill, IObject target, IObject targetSkill, string formula) { if (!CheckFormula(formula) || self == null || selfSkill == null) { return(0.00f); } if (!m_formulaParser.ContainsKey(formula)) { FormulaParserManager.Instance.RegistFormula(formula); } FormulaParser formulaParser = m_formulaParser[formula]; formulaParser.SetSelfObj(self); formulaParser.SetSelfSkill(selfSkill); formulaParser.SetTargetObj(target); formulaParser.SetTargetSkill(targetSkill); return(formulaParser.Value()); }