public GameMain() { Content.RootDirectory = "Content"; IsMouseVisible = true; Window.AllowUserResizing = false; IsFixedTimeStep = true; _graphicsDeviceManager = new GraphicsDeviceManager(this) { IsFullScreen = false, PreferredBackBufferWidth = 800, PreferredBackBufferHeight = 600, PreferredBackBufferFormat = SurfaceFormat.Color, PreferMultiSampling = false, PreferredDepthStencilFormat = DepthFormat.None, SynchronizeWithVerticalRetrace = true, }; _ecs = new EntityComponentSystem(this); _entityManager = _ecs.EntityManager; // scan for components and systems in provided assemblies _ecs.Scan(Assembly.GetExecutingAssembly()); Services.AddService(Content); Services.AddService(_ecs); Services.AddService(_random); }
protected override void Initialize() { _ecs = new EntityComponentSystem(this); Services.AddService(_ecs); _ecs.Scan(Assembly.GetExecutingAssembly()); base.Initialize(); }
protected override void Initialize() { esc = new EntityComponentSystem(this); entityManager = esc.EntityManager; esc.Scan(Assembly.GetExecutingAssembly()); Services.AddService(spriteBatch); base.Initialize(); }
public void ECS_CreateEntityFromTemplate_UsingManager_Test() { // Seems to work with null. var ecs = new EntityComponentSystem(null); ecs.Scan(typeof(EntityTemplateUsingManager).Assembly); var manager = ecs.EntityManager; Entity entity = null; try { entity = manager.CreateEntityFromTemplate(EntityTemplateUsingManager.Name); } catch (Exception e) { Assert.Fail("Failed to create entity from template.\n" + e.StackTrace); } Assert.NotNull(entity); Assert.NotNull(entity.Get <EntityComponentBasic>()); }