public Controller() { Parser = new Parser(); InputView = new InputView(); OutputView = new OutputView(); OutputView.DisplayMenu(); while (true) { ConsoleKeyInfo input = InputView.WaitForInput(); if (input.Key != ConsoleKey.S) { int.TryParse(input.KeyChar.ToString(), out int number); if (number >= 1 && number <= 6) { CurrentMaze = number; break; } } else { return; } } Maze = Parser.ParseMaze(CurrentMaze); Start(); }
public Game() { DesFieldCounter = 0; WinCounter = 0; Player = new Player(); Employee = new Employee(); parser = new Parser(); _outputView = new OutputView(); _inputView = new InputView(this); _outputView.StartMessage(); Level = _inputView.ChooseMaze(); parser.CreateMaze(Level, Player, this, Employee); FirstField = parser.firstField2; Play(); }
private void Start() { while (true) { DisplayMaze(); ConsoleKeyInfo input = InputView.WaitForInput(); switch (input.Key) { case ConsoleKey.S: return; case ConsoleKey.R: Maze = Parser.ParseMaze(CurrentMaze); break; case ConsoleKey.UpArrow: Maze.Forklift.Move(Dir.UP); Maze.Employee.DoSomething(); break; case ConsoleKey.RightArrow: Maze.Forklift.Move(Dir.RIGHT); Maze.Employee.DoSomething(); break; case ConsoleKey.DownArrow: Maze.Forklift.Move(Dir.DOWN); Maze.Employee.DoSomething(); break; case ConsoleKey.LeftArrow: Maze.Forklift.Move(Dir.LEFT); Maze.Employee.DoSomething(); break; } if (CheckWin()) { break; } } OutputView.DisplayVictory(); Console.ReadKey(); }
private void DisplayMaze() { String output = ""; Tile head = Maze.Head; Tile currentTile = head; while (head != null) { while (currentTile != null) { output += currentTile.Description; currentTile = currentTile.East; } output += "\n"; head = head.South; currentTile = head; } OutputView.DisplayMaze(output); }
//constructor public Game() { inputView = new InputView(); outputView = new OutputView(); Parser parser; }
public Controller() { inputView = new InputView(); outputView = new OutputView(); parser = new Parser(); }
public Parser() { outputView = new OutputView(); }
public void print() { OutputView p = new OutputView(); p.StandardScreen(firstField2, levelWidth, levelHeight); }