Ejemplo n.º 1
0
        internal override void Evaluate()
        {
            OnEvaluation();
            //build packages for all data
            Inputdata = gatherInputPortData();
            if (CodePointer == null)
            {
                Debug.Break();
            }


            //on this node we actually want to gather execution data for the inputexecutionNode's output port
            //this is so that upon the execution of this node, we insert a task which executes whatever node that inputrigger
            //points to...

            //TODOneed to watch out for this, I believe the issue is that we need the invariant, that when the execution data is calculated
            //we're executing, because we also gather the current task... we need to atleast make sure we update the current task
            //at the time we do the insertion of the task....
            //a fix for now is to at the minimum create a property publicly reexecutes gather execution data
            //on the downstream node we really want to gather...
            Funcdef.InputExecutionNodes.First().ForceGatherExecutionData();
            Executiondata = Funcdef.InputExecutionNodes.First().Executiondata;
            Debug.Log("we're grabbing execution pointers not from this node, but from downstream");
            Executiondata.ForEach(x => Debug.Log(x.First));
            //here we use the codepointer instead of the code string
            var evalpackage = new EvaluationPackage(CodePointer,
                                                    Inputdata.Select(x => x.First).ToList(),
                                                    Inputdata.Select(x => x.Second).ToList(),
                                                    Outputs.Select(x => x.NickName).ToList(),
                                                    Executiondata);
            var outvar = Evaluator.Evaluate(evalpackage);

            this.StoredValueDict = outvar;
            OnEvaluated();
        }
        protected override void Start()
        {
            base.Start();
            AddExecutionOutPutPort("done");

            CodePointer               = CompiledNodeEval;
            Evaluator                 = this.gameObject.AddComponent <CsharpEvaluator> ();
            Executiondata             = gatherExecutionData();
            pointerToFirstNodeInGraph = Executiondata.First().Second;
        }
 protected override void OnNodeModified()
 {
     //if start hasnt run yet we wont have any outputs on this node yet,
     //so dont try to lookup evaldata... will throw
     if (ExecutionOutputs != null)
     {
         base.OnNodeModified();
         Executiondata             = gatherExecutionData();
         pointerToFirstNodeInGraph = Executiondata.First().Second;
     }
 }