Example #1
0
        public void WorldComponentCacheAfterDeserializing()
        {
            var World = WorldTest.GetTestWorld();
            var State = STACK.State.Serialization.SaveState <World>(World);
            var Temp  = (World)STACK.State.Serialization.LoadState <World>(State);

            Assert.AreSame(World.Get <Mouse>(), World.Components.Where(i => i is Mouse).FirstOrDefault());
        }
Example #2
0
        public void WorldComponentsAfterDeserializing()
        {
            var World = WorldTest.GetTestWorld();

            World.Get <Camera>().Zoom = 2f;

            var Bytes             = STACK.State.Serialization.SaveState <World>(World);
            var DeserializedWorld = (World)STACK.State.Serialization.LoadState <World>(Bytes);

            Assert.AreEqual(2f, DeserializedWorld.Get <Camera>().Zoom);
        }
Example #3
0
        public void ReferencesAfterDeserializing()
        {
            var World = WorldTest.GetTestWorld();
            var Scene = new Scene("s2");

            Scene.Push(new Entity("o2")
            {
                DrawScene = World["s1"]
            });
            Scene.Push(new Entity("o3")
            {
                DrawScene = World["s1"]
            });
            World.Push(Scene);
            var Check  = State.Serialization.SaveState(World);
            var World2 = State.Serialization.LoadState <World>(Check);

            World2.Initialize(true);
            var SecondScene = World2.Scenes.FirstOrDefault(s => s.ID == "s2");

            Assert.AreSame(SecondScene, SecondScene.GameObjectCache.Entities[0].UpdateScene);
            Assert.AreSame(SecondScene, SecondScene.GameObjectCache.Entities[1].UpdateScene);
        }