示例#1
0
        public GameController()
        {
            _outputView = new OutputView();
            _inputView  = new InputView();
            LevelReader p = new LevelReader();

            _maze = p.ReadFile(AskLevel());
            _outputView.PrintMaze(_maze.FirstTile);
            GameCycle();
        }
示例#2
0
        public void GameCycle()
        {
            while (true)
            {
                _maze.CollectedAllDiamonds();
                DoEveryTick();

                if (_tick == 2)
                {
                    LetLooseObjectsFall();
                    _timer--;
                    _tick = 0;
                }
                else
                {
                    _tick++;
                }

                if (_timer == 120)
                {
                    _maze.ExplodeAllTNT();
                }
                ;

                if (_maze.ExitGame())
                {
                    System.Console.Clear();
                    FinishGame();
                    break;
                }

                _maze.CheckIfFireFliesDied();

                if (!_maze.CheckIfPlayerIsAlive())
                {
                    _outputView.GameOver();
                    FinishGame();
                    break;
                }

                _outputView.PrintMaze(_maze.FirstTile);
                _outputView.PrintScore((_maze.DiamondsCollected * 10) + (_maze.AmountOfFireFliesKilled * 250));
                _outputView.PrintTime(_timer, _tick);
            }
            System.Console.ReadLine();
        }