public Game() { Messages = new List<string>(); Players = new ThreadSafeList<Player>(); ActorList = new List<Actor>(); BulletList = new List<Bullet>(); Map = new Map(); }
public static Map CreateFromArray(string[] data) { Map map = new Map(); for (int y = 0; y < data.Length; y++) { string line = data[y]; List<Tile> list = new List<Tile>(); for (int x = 0; x < line.Length; x++) { char symbol = line[x]; Tile tile = new Tile(x, y); tile.Symbol = symbol; if (symbol != ' ') tile.IsSolid = true; list.Add(tile); } map.Tiles.Add(list); } return map; }
public void LoadMap(string filename) { string[] data = File.ReadAllLines(@"Maps\" + filename); LoadedMap = Map.CreateFromArray(data); }