private Graph CreateGraph(IWorldBase world) { if (world == null) { return(null); } var systems = WorldHelper.GetSystems(world); var modules = WorldHelper.GetModules(world); var graph = new Graph(this.checkpointCollector); graph.worldGraph = this; var rootNode = graph.AddNode(new WorldNode(world)); var modulesVisualContainer = graph.AddNode(rootNode, new ModulesVisualContainer(this.CreateSubGraph <ModuleVisualNode>(modules, "Update", WorldStep.VisualTick)), modules); var beginTick = graph.AddNode(modulesVisualContainer, new BeginTickNode(null), "Simulate"); var modulesLogicContainer = graph.AddNode(beginTick, new ModulesLogicContainer(this.CreateSubGraph <ModuleLogicNode>(modules, "AdvanceTick", WorldStep.LogicTick)), modules); var pluginsLogicContainer = graph.AddNode(modulesLogicContainer, new PluginsLogicContainer(null), "PlayPluginsForTick"); var systemsLogicContainer = graph.AddNode(pluginsLogicContainer, new SystemsLogicContainer(this.CreateSubGraph <SystemLogicNode>(systems, "AdvanceTick", WorldStep.LogicTick)), systems); var removeOnceComponents = graph.AddNode(systemsLogicContainer, new RemoveOnceComponentsNode(null), "RemoveComponentsOnce"); var endTick = graph.AddNode(removeOnceComponents, new EndTickNode(null)); var pluginsLogicSimulateContainer = graph.AddNode(endTick, new PluginsLogicSimulateContainer(null), "SimulatePluginsForTicks"); var systemsVisualContainer = graph.AddNode(pluginsLogicSimulateContainer, new SystemsVisualContainer(this.CreateSubGraph <SystemVisualNode>(systems, "Update", WorldStep.VisualTick)), systems); graph.AddNode(systemsVisualContainer, new RemoveMarkersNode(null), "RemoveMarkers"); return(graph); }
public WorldGraph(IWorldBase world) { if (world == null) { return; } this.world = world; this.world.SetCheckpointCollector(this.checkpointCollector = new CheckpointCollector()); this.graph = this.CreateGraph(world); }
public static IList <ME.ECS.IModuleBase> GetModules(IWorldBase world) { var field = world.GetType().GetField("modules", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); return(((IList)field.GetValue(world)).Cast <ME.ECS.IModuleBase>().ToList()); }
/*public static Dictionary<int, ME.ECS.IComponentsBase> GetComponentsStorage(IWorldBase world) { * * var field = world.GetType().GetField("componentsCache", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); * var dic = (IList)field.GetValue(world); * WorldHelper.componentsCache.Clear(); * foreach (var item in dic) { * * WorldHelper.componentsCache.Add(, (ME.ECS.IComponentsBase)item); * * } * * return WorldHelper.componentsCache; * * }*/ public static IList[] GetEntitiesStorage(IWorldBase world) { var field = world.GetType().GetField("storagesCache", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); return((IList[])field.GetValue(world)); }
public static FiltersStorage GetFilters(IWorldBase world) { var field = world.GetType().GetField("filtersStorage", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); return((FiltersStorage)field.GetValue(world)); }