Example #1
0
        public void GetAllEntities_WithSharedComponentData()
        {
            var entity = m_Manager.CreateEntity();

            m_Manager.AddSharedComponentData(entity, new EcsTestSharedComp(5));

            var debugEntities = DebugEntity.GetAllEntities(m_Manager);

            EntitiesAssert.AreEqual(
                new[] { new DebugEntity(entity,
                                        new DebugComponent {
                    Type = typeof(EcsTestSharedComp), Data = new EcsTestSharedComp(5)
                }) },
                debugEntities);

            EntitiesAssert.AreNotEqual(
                new[] { new DebugEntity(entity,
                                        new DebugComponent {
                    Type = typeof(EcsTestSharedComp), Data = new EcsTestSharedComp(6)
                }) },
                debugEntities);
        }
Example #2
0
        public void GetAllEntities_WithComponentObject()
        {
            var entity    = m_Manager.CreateEntity();
            var component = new TestClassComponent {
                Value = 5
            };

            m_Manager.AddComponentObject(entity, component);

            var debugEntities = DebugEntity.GetAllEntities(m_Manager);

            EntitiesAssert.AreEqual(
                new[] { new DebugEntity(entity,
                                        new DebugComponent {
                    Type = typeof(TestClassComponent), Data = component
                }) },
                debugEntities);

            // currently we are doing Equals comparisons, so validate it
            EntitiesAssert.AreEqual(
                new[] { new DebugEntity(entity,
                                        new DebugComponent {
                    Type = typeof(TestClassComponent), Data = new TestClassComponent {
                        Value = 5
                    }
                }) },
                debugEntities);
            EntitiesAssert.AreNotEqual(
                new[] { new DebugEntity(entity,
                                        new DebugComponent {
                    Type = typeof(TestClassComponent), Data = new TestClassComponent {
                        Value = 6
                    }
                }) },
                debugEntities);
        }