コード例 #1
0
        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);
        }
コード例 #2
0
        protected override void Initialize()
        {
            _ecs = new EntityComponentSystem(this);
            Services.AddService(_ecs);

            _ecs.Scan(Assembly.GetExecutingAssembly());

            base.Initialize();
        }
コード例 #3
0
ファイル: Game1.cs プロジェクト: joleeee/ESC-Test
        protected override void Initialize()
        {
            esc           = new EntityComponentSystem(this);
            entityManager = esc.EntityManager;
            esc.Scan(Assembly.GetExecutingAssembly());
            Services.AddService(spriteBatch);

            base.Initialize();
        }
コード例 #4
0
        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>());
        }