コード例 #1
0
ファイル: Game.cs プロジェクト: Zimnx/AsciiHack
 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;
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: Zimnx/AsciiHack
 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();
 }