Esempio n. 1
0
        public object GetValue(ExecutionContext executionContext, Type targetType)
        {
            object value;

            if (linkOutput != null)
            {
                value = linkOutput.GetValue(executionContext, targetType);
            }
            else
            {
                if (defaultValue != null)
                {
                    value = defaultValue.GetDefaultValue(executionContext, targetType);
                }
                else
                {
                    value = this.value;
                }
            }
            if (targetType == null)
            {
                targetType = valueType;
            }
            value = FlowNode.ChangeType(value, targetType);
            return(value);
        }
Esempio n. 2
0
        public override void ExecuteContent(Flow flow)
        {
            object     instance = thisIn.GetValue(flow.Context);
            MethodInfo method;

            if (instance == null)
            {
                Debug.LogError("CallNode instance null");
                return;
            }

            Type instanceType = instance.GetType();

            method = instanceType.GetMethod(methodName);

            if (method == null)
            {
                Debug.LogError("not found method  " + methodName);
            }

            if (method == null)
            {
                return;
            }


            method.Invoke(instance, null);
        }
Esempio n. 3
0
 public override void Flow(Flow flow)
 {
     if (condition.GetValue(flow.Context))
     {
         trueOut.Execute(flow);
     }
     else
     {
         falseOut.Execute(flow);
     }
 }
Esempio n. 4
0
        public override void ExecuteContent(Flow flow)
        {
            ExecutionContext context = flow.Context;
            Object           obj;

            obj = objectIn.GetValue(context);
            if (obj)
            {
                Object.Destroy(obj, delayIn.GetValue(context));
            }
        }
Esempio n. 5
0
        public override void ExecuteContent(Flow flow)
        {
            ExecutionContext context = flow.Context;
            GameObject       go;

            go = gameObjectIn.GetValue(context);
            if (go)
            {
                Object.Destroy(go, delayIn.GetValue(context));
            }
        }
Esempio n. 6
0
        public override void ExecuteContent(Flow flow)
        {
            ExecutionContext context = flow.Context;
            GameObject       go;

            go = gameObjectIn.GetValue(context);
            if (go)
            {
                go.SetActive(false);
            }
        }
Esempio n. 7
0
        public override void ExecuteContent(Flow flow)
        {
            ExecutionContext context = flow.Context;
            Transform        root;

            root = rootIn.GetValue(context);
            Component result = null;

            if (root)
            {
                result = FindComponent(root, nameIn.GetValue(context), typeNameIn.GetValue(context));
            }
            resultOut.SetValue(result);
        }
Esempio n. 8
0
        public override void ExecuteContent(Flow flow)
        {
            object    value    = valueIn.GetValue(flow.Context);
            object    instance = null;
            FieldInfo field    = Field;

            if (!field.IsStatic)
            {
                instance = ThisIn.GetValue(flow.Context);
                if (instance == null)
                {
                    throw new Exception("set field error, instance null ,field: " + field);
                }
            }

            field.SetValue(instance, value);
        }
        public override void ExecuteContent(Flow flow)
        {
            object instance = thisIn.GetValue(flow.Context);


            if (member == null)
            {
                if (instance == null)
                {
                    Debug.LogError("Set Instance null");
                    return;
                }

                Type instanceType = instance.GetType();
                member = instanceType.GetField(property);
                if (member == null)
                {
                    member = instanceType.GetProperty(property);
                }
                if (member == null)
                {
                    Debug.LogError("Member null " + property);
                }
            }

            if (member == null)
            {
                return;
            }

            object value;

            if (member.MemberType == MemberTypes.Property)
            {
                PropertyInfo pInfo = (PropertyInfo)member;
                value = pInfo.GetSetMethod().Invoke(instance, null);
            }
            else
            {
                FieldInfo fInfo = (FieldInfo)member;
                value = fInfo.GetValue(instance);
            }

            valueOut.SetValue(value);
        }
Esempio n. 10
0
        public override void ExecuteContent(Flow flow)
        {
            object       value    = valueIn.GetValue(flow.Context);
            object       instance = null;
            PropertyInfo property = Property;
            var          setter   = property.GetSetMethod();

            if (!setter.IsStatic)
            {
                instance = ThisIn.GetValue(flow.Context);
                if (instance == null)
                {
                    throw new Exception("instance null");
                }
            }

            setter.Invoke(instance, new object[] { value });
        }
Esempio n. 11
0
        public override void ExecuteContent(Flow flow)
        {
            ExecutionContext context = flow.Context;

            Transform result = null;

            string name = nameIn.GetValue(context);

            if (!string.IsNullOrEmpty(name))
            {
                Transform root;
                root = rootIn.GetValue(context);
                if (root)
                {
                    result = FindTransform(root, name);
                }
            }
            resultOut.SetValue(result);
        }
Esempio n. 12
0
        IEnumerator Execute(Flow flow)
        {
            ExecutionContext context = flow.Context;
            float            time;
            float            t = 0;
            float            delta;
            var tickOut = GetFlowOutput("tick");

            isRunning = true;
            Status    = FlowNodeStaus.Waiting;

            while (true)
            {
                DiryAllValueInputNodes(flow);
                ExecuteAllValueInputNode(context, this, flow);
                time = timeIn.GetValue(flow.Context);
                if (t >= time)
                {
                    break;
                }

                delta = (float)deltaIn.GetValue(flow.Context, deltaIn.ValueType);

                if (tickOut.LinkInput != null)
                {
                    elapsedOut.SetValue(t);
                    tickOut.Execute(flow);
                }
                t += delta;
                yield return(null);
            }

            isRunning = false;
            if (Status == FlowNodeStaus.Waiting)
            {
                Status = FlowNodeStaus.Complete;
                elapsedOut.SetValue(t);
                var doneOut = GetFlowOutput("done");
                doneOut.Execute(flow);
            }
        }
Esempio n. 13
0
        public override void ExecuteContent(Flow flow)
        {
            ExecutionContext context = flow.Context;
            Component        c;

            c = componentIn.GetValue(context);
            if (c)
            {
                if (c is Behaviour)
                {
                    ((Behaviour)c).enabled = false;
                }
                else if (c is Collider)
                {
                    ((Collider)c).enabled = false;
                }
                else if (c is Renderer)
                {
                    ((Renderer)c).enabled = false;
                }
            }
        }