public override void LoadContent(ContentManager content, InputManager input) { base.LoadContent(content, input); player = new Player(); map = new Map(); map.LoadContent(content, map, "Map1"); player.LoadContent(content, input); }
public void LoadContent(ContentManager content, Map map, string mapID) { layer = new Layer(); collision = new Collision(); id = mapID; layer.LoadContent(map, "Layer1"); collision.LoadContent(content, mapID); }
public void LoadContent(Map map, string layerID) { tiles = new List<List<Tile>>(); attributes = new List<List<string>>(); contents = new List<List<string>>(); fileManager = new FileManager(); motion = new List<string>(); solid = new List<string>(); content = new ContentManager(ScreenManager.Instance.Content.ServiceProvider, "Content"); fileManager.LoadContent("Load/Maps/" + map.ID + ".txt", attributes, contents, layerID); int indexY = 0; for (int i = 0; i < attributes.Count; i++) { for (int j = 0; j < attributes[i].Count; j++) { switch (attributes[i][j]) { case "TileSet": tileSheet = content.Load<Texture2D>("TileSets/" + contents[i][j]); break; case "Solid": solid.Add(contents[i][j]); break; case "Motion": motion.Add(contents[i][j]); break; case "StartLayer": List<Tile> tempTiles = new List<Tile>(); Tile.Motion tempMotion = Tile.Motion.Static; Tile.State tempState; for (int k = 0; k < contents[i].Count; k++) { string[] split = contents[i][k].Split(','); tempTiles.Add(new Tile()); if (solid.Contains(contents[i][k])) { tempState = Tile.State.Solid; } else { tempState = Tile.State.Passive; } foreach (string m in motion) { getMotion = m.Split(':'); if (getMotion[0] == contents[i][k]) { tempMotion = (Tile.Motion)Enum.Parse(typeof(Tile.Motion), getMotion[1]); break; } } tempTiles[k].SetTile(tempState, tempMotion, new Vector2(k * 32, indexY * 32), tileSheet, new Rectangle(int.Parse(split[0]) * 32, int.Parse(split[1]) * 32, 32, 32)); } tiles.Add(tempTiles); indexY++; break; } } } }