示例#1
0
        public void CreateEntityDuringStart()
        {
            EcsService service   = EcsServiceFactory.CreateECSManager();
            Entity     entity    = service.CreateEntityFromTemplate <ConfigurableComponentTemplate>();
            var        component = entity.FindComponent <ConfigurableComponent>();
            Entity     newEntity = null;

            component.OnStartAction = configurableComponent =>
            {
                newEntity = service.CreateEntity();
                newEntity.AddComponent <ConfigurableComponent>();
            };

            service.Update(new GameTime());

            Assert.That(component, Is.Not.Null);
            Assert.That(newEntity, Is.Not.Null);
            Assert.That(newEntity.GetComponent <ConfigurableComponent>(), Is.Not.Null);
        }