public void RemoveFromPlayerLoop_WorldNotInPlayerLoop_DoesntThrow()
 {
     using (var world = new World("Test World"))
     {
         world.CreateSystem <InitializationSystemGroup>();
         var playerLoop = PlayerLoop.GetDefaultPlayerLoop();
         ScriptBehaviourUpdateOrder.RemoveWorldFromPlayerLoop(world, ref playerLoop);
         Assert.IsFalse(ScriptBehaviourUpdateOrder.IsWorldInPlayerLoop(world, playerLoop));
     }
 }
        public void RemoveFromPlayerLoop_OtherWorldsInPlayerLoop_NotAffected()
        {
            using (var worldA = new World("Test World A"))
                using (var worldB = new World("Test World B"))
                {
                    worldA.CreateSystem <InitializationSystemGroup>();
                    worldB.CreateSystem <InitializationSystemGroup>();
                    var playerLoop = PlayerLoop.GetDefaultPlayerLoop();
                    ScriptBehaviourUpdateOrder.AddWorldToPlayerLoop(worldA, ref playerLoop);
                    ScriptBehaviourUpdateOrder.AddWorldToPlayerLoop(worldB, ref playerLoop);
                    Assert.IsTrue(ScriptBehaviourUpdateOrder.IsWorldInPlayerLoop(worldA, playerLoop));
                    Assert.IsTrue(ScriptBehaviourUpdateOrder.IsWorldInPlayerLoop(worldB, playerLoop));

                    ScriptBehaviourUpdateOrder.RemoveWorldFromPlayerLoop(worldA, ref playerLoop);
                    Assert.IsFalse(ScriptBehaviourUpdateOrder.IsWorldInPlayerLoop(worldA, playerLoop));
                    Assert.IsTrue(ScriptBehaviourUpdateOrder.IsWorldInPlayerLoop(worldB, playerLoop));
                }
        }
Exemplo n.º 3
0
        public static void Shutdown()
        {
            // shutdown ECS
            var playerLoop = PlayerLoop.GetCurrentPlayerLoop();

            foreach (var w in World.All)
            {
                ScriptBehaviourUpdateOrder.RemoveWorldFromPlayerLoop(w, ref playerLoop);
            }

            PlayerLoop.SetPlayerLoop(playerLoop);

            World.DisposeAllWorlds();

            WordStorage.Instance.Dispose();
            WordStorage.Instance = null;

            // clean module
            Clean();
        }