Exemplo n.º 1
0
        public void TestSystemAddedAfterEntity()
        {
            world = CreateWorld();
            info = world.DebugInfo;

            AddComponents(world.CreateEntity(), new ComponentA());
            AddComponents(world.CreateEntity(), new ComponentB());
            AddComponents(world.CreateEntity(), new ComponentB(), new ComponentC());

            systemO = new EmptySystem();
            systemA = new SystemA();
            systemB = new SystemB();
            systemBC = new SystemBC();
            world.AddSystem(systemO);
            world.AddSystem(systemA);
            world.AddSystem(systemB);
            world.AddSystem(systemBC);

            AddComponents(world.CreateEntity(), new ComponentA());

            Assert.AreEqual(4, info.EntityCount(systemO));
            Assert.AreEqual(2, info.EntityCount(systemA));
            Assert.AreEqual(2, info.EntityCount(systemB));
            Assert.AreEqual(1, info.EntityCount(systemBC));
        }
Exemplo n.º 2
0
        public void TestSystemUpdateSingle()
        {
            world = CreateWorld();
            SystemU u = new SystemU();
            world.AddSystem(u);

            world.Update<SystemU>(1);
            Assert.AreEqual(true, u.IsUpdated, "Expect U to be updated.");
        }
Exemplo n.º 3
0
        public void TestSystemUpdateSingleOther()
        {
            world = CreateWorld();
            SystemU u = new SystemU();
            world.AddSystem(u);

            world.Update<SystemA>(1);
            Assert.AreEqual(false, u.IsUpdated, "Expect U to not be updated, only A is updated.");
        }
Exemplo n.º 4
0
        public void TestSystemExcludedUpdate()
        {
            world = CreateWorld();
            SystemU u = new SystemU();
            world.AddSystem(u);

            world.UpdateAll(1, typeof(SystemU));
            Assert.AreEqual(false, u.IsUpdated, "Expect U to be excluded, and thus not updated.");
        }