//这个函数展示最简单的计算 void Eval1() { CQuarkBlock block = new CQuarkBlock(); int ret = (int)block.Execute("1+2"); Debug.Log("return = " + ret); }
//这个函数展示了先从外部向env赋值,再做计算 void Eval2() { CQuarkBlock block = new CQuarkBlock(); block.SetValue("HP1", 200); block.SetValue("HP2", 300); double d = (double)block.Execute("HP1 + HP2 * 0.5"); Debug.Log("d = " + d); float f = (float)block.Execute("HP1 + HP2 * 0.5f"); Debug.Log("f = " + f); }