Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 //constructor
 public Game()
 {
     inputView  = new InputView();
     outputView = new OutputView();
     Parser parser;
 }
Ejemplo n.º 6
0
 public Controller()
 {
     inputView  = new InputView();
     outputView = new OutputView();
     parser     = new Parser();
 }
Ejemplo n.º 7
0
 public Parser()
 {
     outputView = new OutputView();
 }
Ejemplo n.º 8
0
        public void print()
        {
            OutputView p = new OutputView();

            p.StandardScreen(firstField2, levelWidth, levelHeight);
        }