コード例 #1
0
        private Graph CreateSubGraph <T>(IEnumerable list, string methodName, WorldStep step) where T : Node
        {
            var innerGraph = new Graph(this.checkpointCollector);

            innerGraph.worldGraph = this;
            innerGraph.vertical   = true;
            var enter    = innerGraph.AddNode(new SubmoduleEnterNode(null));
            var lastNode = enter;

            foreach (var item in list)
            {
                if (WorldHelper.HasMethod(item, methodName) == true)
                {
                    lastNode = innerGraph.AddNode(lastNode, (T)System.Activator.CreateInstance(typeof(T), item), item, step);
                }
            }
            innerGraph.AddNode(lastNode, new SubmoduleExitNode(lastNode));
            return(innerGraph);
        }
コード例 #2
0
        private Graph CreateSubGraph <T>(ME.ECS.Collections.IBufferArray list, string methodName, WorldStep step) where T : Node
        {
            var innerGraph = new Graph(this.checkpointCollector);

            innerGraph.worldGraph = this;
            innerGraph.vertical   = true;
            var enter    = innerGraph.AddNode(new SubmoduleEnterNode(null));
            var lastNode = enter;
            var arr      = list.GetArray();

            for (int i = 0; i < list.Count; ++i)
            {
                var item = arr.GetValue(i);
                if (WorldHelper.HasMethod(item, methodName) == true)
                {
                    lastNode = innerGraph.AddNode(lastNode, (T)System.Activator.CreateInstance(typeof(T), item), item, step);
                }
            }
            innerGraph.AddNode(lastNode, new SubmoduleExitNode(lastNode));
            return(innerGraph);
        }
コード例 #3
0
 public bool HasMethod(object instance, string methodName)
 {
     return(WorldHelper.HasMethod(instance, methodName));
 }