static World GetLiveLinkWorld()
        {
            DefaultWorldInitialization.DefaultLazyEditModeInitialize();
            var world = World.DefaultGameObjectInjectionWorld;

            // This should be a fresh world, but make sure that it is not part of the player loop so we have manual
            // control on its updates.
            ScriptBehaviourUpdateOrder.RemoveWorldFromCurrentPlayerLoop(world);
            return(world);
        }
        public void CurrentPlayerLoopWrappers_Work()
        {
            using (var world = new World("Test World"))
            {
                // world must have at least one of the default top-level groups to add
                var initSysGroup = world.CreateSystem <InitializationSystemGroup>();

                Assert.IsFalse(ScriptBehaviourUpdateOrder.IsWorldInCurrentPlayerLoop(world));
                ScriptBehaviourUpdateOrder.AddWorldToCurrentPlayerLoop(world);
                Assert.IsTrue(ScriptBehaviourUpdateOrder.IsWorldInCurrentPlayerLoop(world));
                ScriptBehaviourUpdateOrder.RemoveWorldFromCurrentPlayerLoop(world);
                Assert.IsFalse(ScriptBehaviourUpdateOrder.IsWorldInCurrentPlayerLoop(world));
            }
        }
コード例 #3
0
        public void Setup()
        {
            PreviousGameObjectInjectionWorld = World.DefaultGameObjectInjectionWorld;
            if (PreviousGameObjectInjectionWorld != null)
            {
                _wasInPlayerLoop = ScriptBehaviourUpdateOrder.IsWorldInCurrentPlayerLoop(PreviousGameObjectInjectionWorld);
                if (_wasInPlayerLoop)
                {
                    ScriptBehaviourUpdateOrder.RemoveWorldFromCurrentPlayerLoop(PreviousGameObjectInjectionWorld);
                }
            }
            else
            {
                _wasInPlayerLoop = false;
            }

            World.DefaultGameObjectInjectionWorld = null;
        }
コード例 #4
0
        protected static void SwitchWorlds()
        {
            var entityManager = DefaultWorld.EntityManager;
            var entities      = entityManager.GetAllEntities();

            entityManager.DestroyEntity(entities);
            entities.Dispose();

            if (DefaultWorld.IsCreated)
            {
                var systems = DefaultWorld.Systems;
                foreach (var s in systems)
                {
                    s.Enabled = false;
                }
                ScriptBehaviourUpdateOrder.RemoveWorldFromCurrentPlayerLoop(DefaultWorld);
                DefaultWorld.Dispose();
            }

            DefaultWorldInitialization.Initialize("Default World", false);
        }
コード例 #5
0
 public override void TearDown()
 {
     ScriptBehaviourUpdateOrder.RemoveWorldFromCurrentPlayerLoop(World);
     base.TearDown();
 }