public Game() { KeyState.OnKeyPressed += KeyState_OnKeyPressed; currentLevel = 1; //LoadLevel(currentLevel); player = new Player(30, 30); board = new Board(); board[30, 30] = Board.Field.EMPTY; board[30, 29] = Board.Field.HAY; }
private void LoadLevel(int level) { var levelFile = File.Open(Environment.CurrentDirectory + "/Levels/Level" + level + ".txt", FileMode.Open); StreamReader sr = new StreamReader(levelFile); string[] playerPos = sr.ReadLine().Split(' '); player = new Player(Int32.Parse(playerPos[0]), Int32.Parse(playerPos[1])); board = new Board(sr.ReadToEnd().Split(new string[] {"\n","\r"}, StringSplitOptions.RemoveEmptyEntries),Int32.Parse(playerPos[2])); sr.Close(); }