///Calls and returns a value of a custom function in the flowgraph
        public object CallFunction(string name, params object[] args)
        {
            SearchFunction(name);

            if (FunctionNode.TryGetValue(name, out func))
            {
                return(func.Invoke(args));
            }
            return(null);
        }
 ///Calls and returns a value of a custom function in the flowgraph
 public object CallFunction(string name, bool IncludeNestedGraph = false, params object[] args)
 {
     if (IncludeNestedGraph)
     {
         if (!searchOnce)
         {
             searchOnce  = true;
             nestedGraph = behaviour.GetAllNestedGraphs <Graph>(true);
             nestedGraph.Add(behaviour);
             foreach (var g in nestedGraph)
             {
                 if (g.GetType() == typeof(FlowGraph) || g.GetType().IsSubclassOf(typeof(FlowGraph)))
                 {
                     var dict = ((FlowGraph)g).GetFunctions();
                     if (dict != null && dict.Count > 0)
                     {
                         foreach (var d in dict)
                         {
                             FunctionNode.Add(d.Key, d.Value);
                         }
                     }
                 }
             }
         }
     }
     if (IncludeNestedGraph)
     {
         if (FunctionNode.TryGetValue(name, out func))
         {
             return(func.Invoke(args));
         }
         return(null);
     }
     else
     {
         return(behaviour.CallFunction(name, args));
     }
 }