예제 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            var worldBuilder = new WorldBuilder();
            var playerSystem = new PlayerSystem(_entityFactory);

            _world = worldBuilder.AddSystem(new SpriteRenderSystem(GraphicsDevice))
                     .AddSystem(playerSystem)
                     .AddSystem(new EnemySystem())
                     .AddSystem(new ShipBulletMovementSystem())
                     .AddSystem(new ShipBulletAlienCollisionSystem())
                     .Build();
            _entityFactory.World = _world;

            _scalingBatch  = new SpriteBatch(GraphicsDevice);
            _scalingTarget = new RenderTarget2D(GraphicsDevice, 224, 256);

            base.Initialize();
        }