示例#1
0
        static void Main(string[] args)
        {
            IUserInterface keyboard = new KeyboardInterface();
            GameEngine     engine   = Initialize();

            SetAppWindowSizeDimensions();
            engine.Run();
        }
 static void Main(string[] args)
 {
     IUserInterface keyboard = new KeyboardInterface();
     GameEngine engine = Initialize();
    
     SetAppWindowSizeDimensions();
     engine.Run();   
 }
 static GameEngine Initialize()
 {
     Field playerField = new PlayerField(MaxRow, MaxCol);
     Field enemyField = new EnemyField(MaxRow, MaxCol);
     List<Ship> playerShips = new List<Ship>();
     List<Ship> computerShips = new List<Ship>();
     IUserInterface keyboard = new KeyboardInterface();
     IRenderer renderer = new ConsoleRenderer();
     ShipGenerator.Generate(5, playerShips, MaxRow, MaxCol);
     ShipGenerator.Generate(5, computerShips, MaxRow, MaxCol);
     GameEngine engine = new GameEngine(playerField, playerShips, enemyField, computerShips, keyboard, renderer,MinRow,MaxRow,MinCol,MaxCol);
     return engine;
 }
示例#4
0
        static GameEngine Initialize()
        {
            Field          playerField   = new PlayerField(MaxRow, MaxCol);
            Field          enemyField    = new EnemyField(MaxRow, MaxCol);
            List <Ship>    playerShips   = new List <Ship>();
            List <Ship>    computerShips = new List <Ship>();
            IUserInterface keyboard      = new KeyboardInterface();
            IRenderer      renderer      = new ConsoleRenderer();

            ShipGenerator.Generate(5, playerShips, MaxRow, MaxCol);
            ShipGenerator.Generate(5, computerShips, MaxRow, MaxCol);
            GameEngine engine = new GameEngine(playerField, playerShips, enemyField, computerShips, keyboard, renderer, MinRow, MaxRow, MinCol, MaxCol);

            return(engine);
        }