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);
 }
Ejemplo n.º 2
0
        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);
 }
Ejemplo n.º 4
0
 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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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());
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
 }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
 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);
 }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        private ControlOutput Store(Flow flow)
        {
            flow.SetValue(output, flow.GetValue(input));

            return(exit);
        }
Ejemplo n.º 22
0
 protected override void AssignArguments(Flow flow, Collider2D other)
 {
     flow.SetValue(collider, other);
 }
Ejemplo n.º 23
0
        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);
            }
        }
Ejemplo n.º 24
0
 private void MoveNext(Flow flow, ref int currentIndex)
 {
     currentIndex += flow.GetValue <int>(step);
     flow.SetValue(this.currentIndex, currentIndex);
 }
Ejemplo n.º 25
0
 private void AssignMetrics(Flow flow, Data data)
 {
     flow.SetValue(remainingSeconds, data.remaining);
     flow.SetValue(remainingRatio, Mathf.Clamp01(data.remaining / data.duration));
 }
Ejemplo n.º 26
0
 protected override void AssignArguments(Flow flow, string value)
 {
     flow.SetValue(this.value, value);
 }
Ejemplo n.º 27
0
        private ControlOutput Enter(Flow flow)
        {
            flow.SetValue(output, Activator.CreateInstance(type));

            return(exit);
        }
Ejemplo n.º 28
0
 protected override void AssignArguments(Flow flow, AxisEventData data)
 {
     flow.SetValue(this.data, data);
 }
Ejemplo n.º 29
0
 protected override void AssignArguments(Flow flow, float breakForce)
 {
     flow.SetValue(this.breakForce, breakForce);
 }
Ejemplo n.º 30
0
 protected override void AssignArguments(Flow flow, int index)
 {
     flow.SetValue(this.index, index);
     flow.SetValue(text, flow.GetValue <Dropdown>(target).options[index].text);
 }