예제 #1
0
 public Submarine(INavigator navigator, IEnemyTracker enemyTracker, IConsole console,
                  AttackController attackController, ChargeController chargeController)
 {
     _navigator        = navigator;
     _enemyTracker     = enemyTracker;
     _console          = console;
     _attackController = attackController;
     _chargeController = chargeController;
 }
예제 #2
0
        public GameController(IConsole console)
        {
            _console = console;
            string[] inputs;
            inputs     = _console.ReadLine().Split(' ');
            _gameProps = new GameProps
            {
                Width  = int.Parse(inputs[0]),
                Height = int.Parse(inputs[1]),
                MyId   = int.Parse(inputs[2])
            };
            _console.Debug(_gameProps);
            _mapScanner = new MapScanner(_gameProps, _console);
            _navigator  = new PreComputedSpiralNavigator(_mapScanner, _console, reversedModeOn: true, _gameProps);
            var headPositionReducer = new HeadPositionReducer(_gameProps, _mapScanner);

            _enemyTracker = new EnemyTracker(_gameProps, _mapScanner.GetMapOrScan(), console, headPositionReducer);
            var torpedoController = new AttackController(_gameProps, _enemyTracker, _mapScanner, _console, headPositionReducer, _navigator);

            var chargeController = new ChargeController(_enemyTracker);

            _submarine = new Submarine(_navigator, _enemyTracker, _console, torpedoController, chargeController);
            _submarine.Start();
        }