private static Func <object, object[], object> GetInstanceProperty(Expression e, MemberExpression topMember) { var parameter = Expression.Parameter(typeof(object), "local"); var parameters = Expression.Parameter(typeof(object[]), "args"); var castExpression = Expression.Convert(parameter, topMember.Member.DeclaringType); var localExpression = topMember.Update(castExpression); var replaceExpression = ExpressionModifier.Replace(e, topMember, localExpression); replaceExpression = Expression.Convert(replaceExpression, typeof(object)); var compileExpression = Expression.Lambda <Func <object, object[], object> >(replaceExpression, parameter, parameters); return(compileExpression.Compile()); }
void Start() { express = GetComponent <ExpressionModifier>(); voice = GetComponent <AudioSource>(); DOTween.Init(); foreach (EventAction ea in actions) { queueAc.Enqueue(ea); } foreach (GameObject go in pivots) { queueGO.Enqueue(go); } foreach (stringContainer sc in talks) { stringContainersQueue.Enqueue(sc); } anim = GetComponent <Animator>(); playNextAction(); }