Beispiel #1
0
        protected override void LoadContent()
        {
            const int mapSize = 100;

            var texturesManager       = new TexturesManager(Content);
            var entityBuilder         = new EntityBuilder(texturesManager);
            var tileOccupationManager = new TileOccupationManager(mapSize, mapSize);

            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _camera      = new OrthographicCamera(GraphicsDevice);
            _world       = new WorldBuilder()
                           .AddSystem(new ControlSystem())
                           .AddSystem(new CameraSystem())
                           .AddSystem(new SpatialTilePositionSystem(tileOccupationManager))
                           .AddSystem(new UnitPlacementSystem(entityBuilder, _camera, tileOccupationManager))
                           .AddSystem(new MinerProcessingSystem(tileOccupationManager, entityBuilder))
                           .AddSystem(new MineableResourceSystem())
                           .AddSystem(new ProductionUnitOutputSystem(tileOccupationManager))
                           .AddSystem(new TransporterTransportSystem(tileOccupationManager))
                           .AddSystem(new TransportableMovementSystem(tileOccupationManager))
                           .AddSystem(new AlignableSpritePickingSystem(texturesManager))
                           .AddSystem(new TileRenderSystem(_spriteBatch, _camera, new DepthHelper((mapSize, mapSize))))
                           .AddSystem(new MapRenderSystem(_spriteBatch, _camera, mapSize))
                           .Build();

            var mapBuilder = new MapBuilder(_world, entityBuilder, mapSize);

            texturesManager.LoadTextures();
            mapBuilder.BuildMap();

            var gameCamera = entityBuilder.BuildGameCamera(_world.CreateEntity(), _camera, new Vector2(50, 50));

            // TODO: use this.Content to load your game content here
        }
Beispiel #2
0
 public EntityBuilder(TexturesManager texturesManager)
 {
     _texturesManager = texturesManager;
 }