Beispiel #1
0
        public void IsInterestedInExcludingOneComponent()
        {
            var oneAspect = Aspect
                            .Exclude(typeof(DummyComponent))
                            .Build(_componentManager);

            Assert.False(oneAspect.IsInterested(_entityA));
            Assert.True(oneAspect.IsInterested(_entityB));
        }
        public void TestAspectExcludeSingle()
        {
            Aspect      aspect      = Aspect.Exclude(typeof(TestPowerComponent));
            EntityWorld entityWorld = new EntityWorld();
            Entity      entity;

            entity = entityWorld.CreateEntity();
            Assert.IsTrue(aspect.Interests(entity), "Entity without components must be subject to \"Not Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestHealthComponent());
            Assert.IsTrue(aspect.Interests(entity), "Entity with {TestHealthComponent} must be subject to \"Not Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestPowerComponent());
            Assert.IsFalse(aspect.Interests(entity), "Entity with {TestPowerComponent} must NOT be subject to \"Not Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestHealthComponent());
            entity.AddComponent(new TestPowerComponent());
            Assert.IsFalse(aspect.Interests(entity), "Entity with {TestHealthComponent, TestPowerComponent} must NOT be subject to \"Not Powered\" Aspect");
        }
        public DebugUIRenderSystem(Game1 game, GraphicsDevice graphicsDevice, PhysicsSystem physicsSystem, ViewportRenderSystem viewportRenderSystem) : base(Aspect.Exclude())
        {
            _graphicsDevice       = graphicsDevice;
            _physicsSystem        = physicsSystem;
            _viewportRenderSystem = viewportRenderSystem;
            _game = game;

            _imGuiRenderer = new ImGuiRenderer(_graphicsDevice);
            ImGui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true;
            _imGuiRenderer.RebuildFontAtlas();

            _componentTypes = typeof(IComponent).Assembly.GetTypes().Where(
                t => typeof(IComponent).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract);
        }
Beispiel #4
0
 /// <summary>Initializes a new instance of the <see cref="TestNormalEntityProcessingSystem1" /> class.</summary>
 public TestNormalEntityProcessingSystem1()
     : base(Aspect.Exclude(typeof(TestPowerComponent)))
 {
 }