static void Main(string[] args)
        {
            _tileManager         = new TileManager();
            _boxManager          = new BoxManager();
            _mapLoader           = new MapLoader(_tileManager, _boxManager);
            _characterController = new CharacterController(_tileManager, _boxManager);
            _victoryCondition    = new EndTileVictoryCondition(_characterController);
            _renderer            = new Renderer(_tileManager, _characterController, _boxManager);

            Splash();

            var currentLevel = 1;

            LoadLevel(currentLevel);
            _stopWatch = Stopwatch.StartNew();

            while (true)
            {
                if (_victoryCondition.IsMet())
                {
                    currentLevel += 1;
                    var levelLoaded = LoadLevel(currentLevel);
                    if (!levelLoaded)
                    {
                        EndGame();
                        return;
                    }
                }

                _renderer.Update(currentLevel, _stopWatch.Elapsed.TotalSeconds);

                var key     = Console.ReadKey();
                var keyChar = char.ToLower(key.KeyChar);
                if (keyChar == 'r')
                {
                    LoadLevel(currentLevel);
                }
                else
                {
                    _characterController.Update(keyChar);
                }
            }
        }
 public CharacterController(TileManager manager, BoxManager boxManager)
 {
     _manager    = manager;
     _boxManager = boxManager;
 }
Пример #3
0
 public MapLoader(TileManager tileManager, BoxManager boxManager)
 {
     _tileManager = tileManager;
     _boxManager  = boxManager;
 }
 public Renderer(TileManager manager, CharacterController characterController, BoxManager boxManager)
 {
     _tileManager         = manager;
     _characterController = characterController;
     _boxManager          = boxManager;
 }