Пример #1
0
        protected void SetupMultiEntitiesTestGraph(List <EntityTestSetup> setups, StepMultiEntitiesDelegate systemSetup = null, params StepMultiEntitiesDelegate[] frameChecks)
        {
            // Something fishy is going on here, the TypeManager is throwing a fit when adding new ComponentData through
            // live compilation.  Shutting down the TypeManager and re-initializing seems like the way to circumvent the
            // issue, but it does not seem like it's enough.
            // Tearing the world down (along with the TypeManager), and recreating it, works.
            TearDownWorld();
            SetUpWorld();

            List <GraphDefinition> graphDefinitions = new List <GraphDefinition>(setups.Count);
            List <ValueInput[]>    inputArrays      = new List <ValueInput[]>(setups.Count);

            try
            {
                var tempInputs = new List <ValueInput>();
                for (var i = 0; i < setups.Count; i++)
                {
                    var builder = new GraphBuilder();
                    tempInputs.Clear();
                    setups[i].GraphSetup(builder, tempInputs);
                    inputArrays.Add(tempInputs.ToArray());
                    graphDefinitions.Add(builder.Build(new global::DotsStencil.DotsStencil()).GraphDefinition);
                }
            }
            finally
            {
                GC.Collect();
            }

            List <Entity> graphEntities = new List <Entity>(setups.Count);

            // first define every entity so that other system can reference them in System setup
            for (int i = 0; i < setups.Count; i++)
            {
                var entity = SetupDefinitionEntity(graphDefinitions[i], inputArrays[i]);
                graphEntities.Add(entity);
                setups[i].EntityDefined?.Invoke(entity);
            }

            systemSetup?.Invoke(m_EntityManager, graphEntities, 0);

            for (int frameIndex = 0; frameIndex < frameChecks.Length; frameIndex++)
            {
                TestGraph();
                frameChecks[frameIndex]?.Invoke(m_EntityManager, graphEntities, frameIndex + 1);
            }
        }
Пример #2
0
 protected void SetupMultiEntitiesTestGraph(Action <GraphBuilder> setupA, Action <GraphBuilder> setupB, StepMultiEntitiesDelegate systemSetup = null, params StepMultiEntitiesDelegate[] frameChecks)
 {
     SetupMultiEntitiesTestGraph(new EntityTestSetup(setupA), new EntityTestSetup(setupB), systemSetup, frameChecks);
 }
Пример #3
0
 protected void SetupMultiEntitiesTestGraph(EntityTestSetup setupA, EntityTestSetup setupB, EntityTestSetup setupC, StepMultiEntitiesDelegate systemSetup = null, params StepMultiEntitiesDelegate[] frameChecks)
 {
     SetupMultiEntitiesTestGraph(new List <EntityTestSetup> {
         setupA, setupB, setupC
     }, systemSetup, frameChecks);
 }
Пример #4
0
 protected void SetupMultiEntitiesTestGraph(GraphDefinitionSetupDelegate setupA, GraphDefinitionSetupDelegate setupB, StepMultiEntitiesDelegate systemSetup = null, params StepMultiEntitiesDelegate[] frameChecks)
 {
     SetupMultiEntitiesTestGraph(new EntityTestSetup(setupA), new EntityTestSetup(setupB), systemSetup, frameChecks);
 }