コード例 #1
0
ファイル: EntityWorldFacts.cs プロジェクト: discosultan/ecs
            public void RemovesAndReturnsSystemForExistentType()
            {
                EntityWorld target = EmptyWorld();
                var system = new FakeComponent1System();
                target.AddSystem(system);

                Assert.Equal(system, target.RemoveSystem<FakeComponent1System>());
                Assert.Equal(0, target.GetSystems().Count);
            }
コード例 #2
0
ファイル: EntityWorldFacts.cs プロジェクト: discosultan/ecs
            public void ThrowsInvalidOperationForSystemInAnotherWorld()
            {
                EntityWorld target1 = EmptyWorld();
                EntityWorld target2 = EmptyWorld();
                var system = new FakeComponent1System();
                target1.AddSystem(system);

                Assert.Throws<InvalidOperationException>(() => target2.AddSystem(system));
            }
コード例 #3
0
ファイル: EntityWorldFacts.cs プロジェクト: discosultan/ecs
            public void RemovesAndReturnsSystemForExistentType()
            {
                EntityWorld target = EmptyWorld();
                var         system = new FakeComponent1System();

                target.AddSystem(system);

                Assert.Equal(system, target.RemoveSystem <FakeComponent1System>());
                Assert.Empty(target.GetSystems());
            }
コード例 #4
0
ファイル: EntityWorldFacts.cs プロジェクト: discosultan/ecs
            public void ThrowsInvalidOperationForSystemInAnotherWorld()
            {
                EntityWorld target1 = EmptyWorld();
                EntityWorld target2 = EmptyWorld();
                var         system  = new FakeComponent1System();

                target1.AddSystem(system);

                Assert.Throws <InvalidOperationException>(() => target2.AddSystem(system));
            }
コード例 #5
0
ファイル: EntitySystemFacts.cs プロジェクト: discosultan/ecs
            public void IsNotExecutedForComponentOfNoInterest()
            {
                var target = new FakeComponent1System();
                var world = new EntityWorld();
                world.AddSystem(target);
                var component = new FakeComponent2();
                Entity entity = world.CreateEntity();
                entity.AddComponent(component);

                world.Update(TimeSpan.Zero);

                Assert.False(component.Processed);
            }
コード例 #6
0
ファイル: EntitySystemFacts.cs プロジェクト: discosultan/ecs
            public void IsNotExecutedForComponentOfNoInterest()
            {
                var target = new FakeComponent1System();
                var world  = new EntityWorld();

                world.AddSystem(target);
                var    component = new FakeComponent2();
                Entity entity    = world.CreateEntity();

                entity.AddComponent(component);

                world.Update(TimeSpan.Zero);

                Assert.False(component.Processed);
            }
コード例 #7
0
ファイル: EntitySystemFacts.cs プロジェクト: discosultan/ecs
            public void IsNotExecutedForDrawSystemInUpdateLoop()
            {
                var target = new FakeComponent1System();
                var world  = new EntityWorld();

                world.AddSystem(target);
                var    component = new FakeComponent1();
                Entity entity    = world.CreateEntity();

                entity.AddComponent(component);

                world.Draw();

                Assert.False(component.Processed);
            }
コード例 #8
0
ファイル: EntitySystemFacts.cs プロジェクト: discosultan/ecs
            public void IsNotExecutedForDrawSystemInUpdateLoop()
            {
                var target = new FakeComponent1System();
                var world = new EntityWorld();
                world.AddSystem(target);
                var component = new FakeComponent1();
                Entity entity = world.CreateEntity();
                entity.AddComponent(component);

                world.Draw();

                Assert.False(component.Processed);
            }