static void StartGame() { CharacterProtagonist player = new CharacterProtagonist(); // 初始化玩家位置 player.Pos.x = Map.BoundaryY - 2; player.Pos.y = 5; Map mapCheckPoint1 = new Map(); CheckPoint cp = new CheckPoint(); // 添加勇者位置 mapCheckPoint1.maps[player.Pos.x, player.Pos.y] = player.Name; // 添加边界 mapCheckPoint1.BoundaryMap(); // 根据cps传递过来的结果,对map进行更新 mapCheckPoint1.Update(cp.CheckPoint1()); // 画出地图 // mapCheckPoint1.Print(); while (true) { mapCheckPoint1.Print(); var tmpPos = player.PerformMoveBeh(); mapCheckPoint1.Update(tmpPos, player); } }
public void Update(StMyPos pos, CharacterProtagonist player) { if ((pos.x < (BoundaryX - 1)) && (pos.y < (BoundaryY - 1)) && ((pos.x * pos.y) != 0)) { // System.Console.WriteLine($"{pos.x}, {pos.y}"); maps[player.Pos.x, player.Pos.y] = char.MinValue; player.Pos = pos; maps[pos.x, pos.y] = player.Name; } }