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); }
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); }
public bool HasMethod(object instance, string methodName) { return(WorldHelper.HasMethod(instance, methodName)); }