protected override void AssignArguments(Flow flow, AnimationEvent args) { flow.SetValue(stringParameter, args.stringParameter); flow.SetValue(floatParameter, args.floatParameter); flow.SetValue(intParameter, args.intParameter); flow.SetValue(objectReferenceParameter, args.objectReferenceParameter); }
private void AssignMetrics(Flow flow, Data data) { flow.SetValue(elapsedSeconds, data.elapsed); flow.SetValue(elapsedRatio, Mathf.Clamp01(data.elapsed / data.duration)); flow.SetValue(remainingSeconds, Mathf.Max(0, data.duration - data.elapsed)); flow.SetValue(remainingRatio, Mathf.Clamp01((data.duration - data.elapsed) / data.duration)); }
protected override void AssignArguments(Flow flow, Collision collision) { flow.SetValue(collider, collision.collider); flow.SetValue(contacts, collision.contacts); flow.SetValue(impulse, collision.impulse); flow.SetValue(relativeVelocity, collision.relativeVelocity); flow.SetValue(data, collision); }
protected override void AssignArguments(Flow flow, Collision2D collisionData) { flow.SetValue(collider, collisionData.collider); flow.SetValue(contacts, collisionData.contacts); flow.SetValue(relativeVelocity, collisionData.relativeVelocity); flow.SetValue(enabled, collisionData.enabled); flow.SetValue(data, collisionData); }
protected override void AssignArguments(Flow flow, GameObject other) { flow.SetValue(this.other, other); var collisionEvents = new List <ParticleCollisionEvent>(); var data = flow.stack.GetElementData <Data>(this); data.target.GetComponent <ParticleSystem>().GetCollisionEvents(other, collisionEvents); flow.SetValue(this.collisionEvents, collisionEvents); }
public ControlOutput Enter(Flow flow) { if (flow.isCoroutine) { throw new NotSupportedException("Coroutines cannot catch exceptions."); } try { flow.Invoke(@try); } catch (Exception ex) { if (exceptionType.IsInstanceOfType(ex)) { flow.SetValue(exception, ex); flow.Invoke(@catch); } else { throw; } } finally { flow.Invoke(@finally); } return(null); }
public ControlOutput Clear(Flow flow) { var list = flow.GetValue <IList>(listInput); if (list is Array) { flow.SetValue(listOutput, Array.CreateInstance(list.GetType().GetElementType(), 0)); } else { list.Clear(); flow.SetValue(listOutput, list); } return(exit); }
public ControlOutput RemoveAt(Flow flow) { var list = flow.GetValue <IList>(listInput); var index = flow.GetValue <int>(this.index); if (list is Array) { var resizableList = new ArrayList(list); resizableList.RemoveAt(index); flow.SetValue(listOutput, resizableList.ToArray(list.GetType().GetElementType())); } else { list.RemoveAt(index); flow.SetValue(listOutput, list); } return(exit); }
private ControlOutput Clear(Flow flow) { var dictionary = flow.GetValue <IDictionary>(dictionaryInput); flow.SetValue(dictionaryOutput, dictionary); dictionary.Clear(); return(exit); }
public ControlOutput Remove(Flow flow) { var dictionary = flow.GetValue <IDictionary>(dictionaryInput); var key = flow.GetValue <object>(this.key); flow.SetValue(dictionaryOutput, dictionary); dictionary.Remove(key); return(exit); }
public ControlOutput Add(Flow flow) { var list = flow.GetValue <IList>(listInput); var item = flow.GetValue <object>(this.item); if (list is Array) { var resizableList = new ArrayList(list); resizableList.Add(item); flow.SetValue(listOutput, resizableList.ToArray(list.GetType().GetElementType())); } else { list.Add(item); flow.SetValue(listOutput, list); } return(exit); }
private int Start(Flow flow, out int currentIndex, out int lastIndex, out bool ascending) { var firstIndex = flow.GetValue <int>(this.firstIndex); lastIndex = flow.GetValue <int>(this.lastIndex); ascending = firstIndex <= lastIndex; currentIndex = firstIndex; flow.SetValue(this.currentIndex, currentIndex); return(flow.EnterLoop()); }
protected virtual ControlOutput Assign(Flow flow) { var input = flow.GetValue <object>(this.input); var name = flow.GetValue <string>(this.name); GetDeclarations(flow).Set(name, input); flow.SetValue(output, input); return(assigned); }
private ControlOutput Add(Flow flow) { var dictionary = flow.GetValue <IDictionary>(dictionaryInput); var key = flow.GetValue <object>(this.key); var value = flow.GetValue <object>(this.value); flow.SetValue(dictionaryOutput, dictionary); dictionary.Add(key, value); return(exit); }
protected override void AssignArguments(Flow flow, ControllerColliderHit hitData) { flow.SetValue(collider, hitData.collider); flow.SetValue(controller, hitData.controller); flow.SetValue(moveDirection, hitData.moveDirection); flow.SetValue(moveLength, hitData.moveLength); flow.SetValue(normal, hitData.normal); flow.SetValue(point, hitData.point); flow.SetValue(data, hitData); }
private ControlOutput Enter(Flow flow) { var target = GetAndChainTarget(flow); var result = Invoke(target, flow); if (this.result != null) { flow.SetValue(this.result, result); } return(exit); }
private bool MoveNext(Flow flow, IEnumerator enumerator, IDictionaryEnumerator dictionaryEnumerator, ref int currentIndex) { var result = enumerator.MoveNext(); if (result) { if (dictionary) { flow.SetValue(currentKey, dictionaryEnumerator.Key); flow.SetValue(currentItem, dictionaryEnumerator.Value); } else { flow.SetValue(currentItem, enumerator.Current); } currentIndex++; flow.SetValue(this.currentIndex, currentIndex); } return(result); }
protected override void AssignArguments(Flow flow, Joint2D joint) { flow.SetValue(breakForce, joint.breakForce); flow.SetValue(breakTorque, joint.breakTorque); flow.SetValue(connectedBody, joint.connectedBody); flow.SetValue(reactionForce, joint.reactionForce); flow.SetValue(reactionTorque, joint.reactionTorque); flow.SetValue(this.joint, joint); }
private object GetAndChainTarget(Flow flow) { if (member.requiresTarget) { var target = flow.GetValue(this.target, member.targetType); if (supportsChaining && chainable) { flow.SetValue(targetOutput, target); } return(target); } return(null); }
private ControlOutput Assign(Flow flow) { var name = flow.GetValue <string>(this.name); var input = flow.GetValue(this.input); switch (kind) { case VariableKind.Flow: flow.variables.Set(name, input); break; case VariableKind.Graph: Variables.Graph(flow.stack).Set(name, input); break; case VariableKind.Object: Variables.Object(flow.GetValue <GameObject>(@object)).Set(name, input); break; case VariableKind.Scene: Variables.Scene(flow.stack.scene).Set(name, input); break; case VariableKind.Application: Variables.Application.Set(name, input); break; case VariableKind.Saved: Variables.Saved.Set(name, input); break; default: throw new UnexpectedEnumValueException <VariableKind>(kind); } flow.SetValue(output, input); return(assigned); }
private ControlOutput Store(Flow flow) { flow.SetValue(output, flow.GetValue(input)); return(exit); }
protected override void AssignArguments(Flow flow, Collider2D other) { flow.SetValue(collider, other); }
private object Invoke(object target, Flow flow) { if (useExpandedParameters) { switch (inputParameters.Count) { case 0: return(member.Invoke(target)); case 1: return(member.Invoke(target, flow.GetConvertedValue(inputParameters[0]))); case 2: return(member.Invoke(target, flow.GetConvertedValue(inputParameters[0]), flow.GetConvertedValue(inputParameters[1]))); case 3: return(member.Invoke(target, flow.GetConvertedValue(inputParameters[0]), flow.GetConvertedValue(inputParameters[1]), flow.GetConvertedValue(inputParameters[2]))); case 4: return(member.Invoke(target, flow.GetConvertedValue(inputParameters[0]), flow.GetConvertedValue(inputParameters[1]), flow.GetConvertedValue(inputParameters[2]), flow.GetConvertedValue(inputParameters[3]))); case 5: return(member.Invoke(target, flow.GetConvertedValue(inputParameters[0]), flow.GetConvertedValue(inputParameters[1]), flow.GetConvertedValue(inputParameters[2]), flow.GetConvertedValue(inputParameters[3]), flow.GetConvertedValue(inputParameters[4]))); default: throw new NotSupportedException(); } } else { var arguments = new object[parameterCount]; for (int parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++) { if (inputParameters.TryGetValue(parameterIndex, out var inputParameter)) { arguments[parameterIndex] = flow.GetConvertedValue(inputParameter); } } var result = member.Invoke(target, arguments); for (int parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++) { if (outputParameters.TryGetValue(parameterIndex, out var outputParameter)) { flow.SetValue(outputParameter, arguments[parameterIndex]); } } return(result); } }
private void MoveNext(Flow flow, ref int currentIndex) { currentIndex += flow.GetValue <int>(step); flow.SetValue(this.currentIndex, currentIndex); }
private void AssignMetrics(Flow flow, Data data) { flow.SetValue(remainingSeconds, data.remaining); flow.SetValue(remainingRatio, Mathf.Clamp01(data.remaining / data.duration)); }
protected override void AssignArguments(Flow flow, string value) { flow.SetValue(this.value, value); }
private ControlOutput Enter(Flow flow) { flow.SetValue(output, Activator.CreateInstance(type)); return(exit); }
protected override void AssignArguments(Flow flow, AxisEventData data) { flow.SetValue(this.data, data); }
protected override void AssignArguments(Flow flow, float breakForce) { flow.SetValue(this.breakForce, breakForce); }
protected override void AssignArguments(Flow flow, int index) { flow.SetValue(this.index, index); flow.SetValue(text, flow.GetValue <Dropdown>(target).options[index].text); }