コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: Timer.cs プロジェクト: XuToWei/UnityGameFramework
        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));
        }
コード例 #3
0
 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);
 }
コード例 #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);
 }
コード例 #5
0
        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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #9
0
        private ControlOutput Clear(Flow flow)
        {
            var dictionary = flow.GetValue <IDictionary>(dictionaryInput);

            flow.SetValue(dictionaryOutput, dictionary);

            dictionary.Clear();

            return(exit);
        }
コード例 #10
0
        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);
        }
コード例 #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);
        }
コード例 #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());
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #15
0
 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);
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #21
0
ファイル: Cache.cs プロジェクト: XuToWei/UnityGameFramework
        private ControlOutput Store(Flow flow)
        {
            flow.SetValue(output, flow.GetValue(input));

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

            return(exit);
        }
コード例 #28
0
ファイル: OnMove.cs プロジェクト: XuToWei/UnityGameFramework
 protected override void AssignArguments(Flow flow, AxisEventData data)
 {
     flow.SetValue(this.data, data);
 }
コード例 #29
0
 protected override void AssignArguments(Flow flow, float breakForce)
 {
     flow.SetValue(this.breakForce, breakForce);
 }
コード例 #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);
 }