Exemplo n.º 1
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            terrainSprite = Content.Load <Texture2D>(@"Terrain");
            var appSprites = Content.Load <Texture2D>("DesertRatsSprites");

            selectionSprite = CreateSelectorTexture(GraphicsDevice);

            var waterTextures   = new WaterTextures(terrainSprite);
            var cityTexture     = new TextureHolder(terrainSprite, new Rectangle(7 * Config.SpriteSize, 9 * Config.SpriteSize, Config.SpriteSize, Config.SpriteSize));
            var groundTexture   = new TextureHolder(terrainSprite, new Rectangle(0 * Config.SpriteSize, 0, Config.SpriteSize, Config.SpriteSize));
            var landUnitTexture = new TextureHolder(appSprites, new Rectangle(1 + 0 * Config.SpriteSize, 1 + 0, Config.SpriteSize, Config.SpriteSize));

            var spriteSize = new Rectangle(1, 1 + 1 + Config.SpriteSize, Config.SpriteSize, Config.SpriteSize);

            window = new Window(
                waterTextures,
                cityTexture,
                new DefaultStrategy(waterTextures.Sea),
                new CoastWithLandToTheNorthStrategy(waterTextures.CoastWithLandToTheNorth),
                new CoastWithLandToTheSouthStrategy(waterTextures.CoastWithLandToTheSouth),
                new GroundStrategy(groundTexture),
                new LandUnitStrategy(landUnitTexture),
                new CityStrategy(cityTexture)
                );
            window.AddIsland(island);
            window.AddCity(new CityEntity(20, 20));
            window.Include(new LandUnitEntity(21, 20));
        }