public void Setup() { const string objectTypesXmlPath = "Resources/objecttypes.xml"; TmxMap tmxMap = new TmxMap("Resources/TmxParserSample_01.tmx"); tileTextureName = "Tiles"; unitTextureNames = new List <string> { "RedMage", "RedArcher", "RedChampion", "BlueMage", "BlueArcher", "BlueChampion" }; List <ITexture2D> unitSprites = new List <ITexture2D>(); foreach (string textureName in unitTextureNames) { unitSprites.Add(new FakeTexture2D(textureName)); } objectUnderTest = new TmxMapParser(tmxMap, new FakeTexture2D(tileTextureName), unitSprites, objectTypesXmlPath); mapGrid = objectUnderTest.LoadMapGrid(); }
/// <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() { base.Initialize(); const string mapPath = "Content/TmxMaps/Arena_3.tmx"; //TODO Hard-coded for now; remove me once map selector implemented const string objectTypeDefaults = "Content/TmxMaps/objecttypes.xml"; TmxMap tmxMap = new TmxMap(mapPath); TmxMapParser mapParser = new TmxMapParser(tmxMap, terrainTextures, unitSprites, objectTypeDefaults); controlMapper = new GameControlMapper(); mapCamera = new MapCamera(10); mapCamera.SetCameraZoom(1.8f); ITexture2D cursorTexture = guiTextures.Find(texture => texture.GetTexture2D().Name.Contains("Cursor")); gameMap = new MapContainer(mapParser.LoadMapGrid(), cursorTexture); }