Esempio n. 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
        }
 public TransporterTransportSystem(TileOccupationManager tileOccupationManager) : base(Aspect.All(typeof(Transporter), typeof(TilePosition)))
 {
     _tileOccupationManager = tileOccupationManager;
 }
Esempio n. 3
0
 public SpatialTilePositionSystem(TileOccupationManager tileOccupationManager) : base(Aspect.All(typeof(TilePosition), typeof(Spatial)))
 {
     _tileOccupationManager = tileOccupationManager;
 }
 public ProductionUnitOutputSystem(TileOccupationManager tileOccupationManager) : base(Aspect.All(typeof(ProductionUnit), typeof(TilePosition)))
 {
     _tileOccupationManager = tileOccupationManager;
 }
 public MinerProcessingSystem(TileOccupationManager tileOccupationManager, EntityBuilder entityBuilder) : base(Aspect.All(typeof(Unit), typeof(ProductionUnit), typeof(TilePosition)))
 {
     _tileOccupationManager = tileOccupationManager;
     _entityBuilder         = entityBuilder;
 }
Esempio n. 6
0
 public UnitPlacementSystem(EntityBuilder entityBuilder, OrthographicCamera camera, TileOccupationManager tileOccupationManager) : base(Aspect.All(typeof(Placeable)))
 {
     _camera = camera;
     _tileOccupationManager = tileOccupationManager;
     _entityBuilder         = entityBuilder;
 }