Exemplo n.º 1
0
        public void TestSystemOnNewEntityContainerInitialization()
        {
            var archetypes = new List <Archetype>()
            {
                new Archetype("Test")
                {
                    Components =
                    {
                        { typeof(ComponentBinding <ItemStorage>), new ComponentBinding <ItemStorage>() },
                    }
                },
            };

            var systems = new List <SystemConfiguration>()
            {
                new SystemConfiguration <ItemStorageSystem>()
            };

            var configuration = new ECSConfiguration(archetypes, systems, null);
            var scenario      = new TestScenario()
            {
                Configuration = configuration
            };
            var    ecs = TestInstaller.CreatTestRoot(scenario).ECS;
            Entity entity;

            Assert.That(ecs.TryCreateEntityFromArchetype("Test", out entity));

            var component = entity.GetComponent <ItemStorage>();

            Assert.That(component, Is.Not.Null);
            Assert.That(component.Items.Length, Is.EqualTo(SimulationConstants.SubsystemMaxItems));
            Assert.That(component.Items[0], Is.Not.Null);
        }
Exemplo n.º 2
0
        public void TestComponentCreationViaArchetype()
        {
            var configuration = new ECSConfiguration(new List <Archetype>()
            {
                AntivirusWorkstation.Archetype
            }, null, null);
            var scenario = new TestScenario()
            {
                Configuration = configuration
            };
            var ecs = TestInstaller.CreatTestRoot(scenario).ECS;

            Entity entity;

            ecs.TryCreateEntityFromArchetype(AntivirusWorkstation.Archetype, out entity);
        }