public override void Invoke() { FieldInfo toInfo = CopyAction.Unravel(copyTo, pathTo); MethodInfo fromInfo = UnravelMethod(copyFrom, pathFrom); toInfo.SetValue(copyTo, fromInfo.Invoke(copyFrom, unravel.Select(x => x.Unravel()).ToArray())); }
MethodInfo UnravelMethod(Component objec, string path) { var obj = objec; FieldInfo info = CopyAction.Unravel(obj, String.Join(".", path.Split('.').Take(path.Split('.').Length - 1).ToArray())); string lastProp = path.Split('.').Last(); return(info.GetType().GetMethod(lastProp)); }
public override void Invoke() { float val = (float)CopyAction.Unravel(script, property).GetValue(script); string exp = ((string)expression.Clone()).Replace("x", val.ToString()); float toSet = (float)new System.Xml.XPath.XPathDocument (new System.IO.StringReader("< r />")).CreateNavigator().Evaluate (string.Format("number({0})", new System.Text.RegularExpressions.Regex(@"([\+\-\*])").Replace(exp, " ${1} ").Replace("/", " div ").Replace("%", " mod "))); CopyAction.Unravel(script, property).SetValue(script, toSet); }
IEnumerator Wri() { FieldInfo info = CopyAction.Unravel(writeTo, path); info.SetValue(writeTo, ""); finished = false; foreach (var item in toWrite) { info.SetValue(writeTo, (string)info.GetValue(writeTo) + item); yield return(new WaitForSeconds(delay)); } finished = true; }
public override bool Fulfilled() { switch (sign) { case Sign.less: return((float)CopyAction.Unravel(comp, path).GetValue(comp) < (float)CopyAction.Unravel(equal, equalTo).GetValue(equal)); case Sign.equal: return(CopyAction.Unravel(comp, path).GetValue(comp).Equals(CopyAction.Unravel(equal, equalTo).GetValue(equal))); case Sign.more: return((float)CopyAction.Unravel(comp, path).GetValue(comp) > (float)CopyAction.Unravel(equal, equalTo).GetValue(equal)); } return(false); }
public FieldInfo Unravel() { return(CopyAction.Unravel(x, path)); }