Esempio n. 1
0
 public override void NewRoundStarted(GameMap gameState)
 {
     ConsoleRender.RenderToConsolePretty(gameState, BattleshipPlayer.PlayerType);
     if (gameState.Phase == 1)
     {
         try
         {
             FirstRoundCommand();
         }
         catch (Exception exception)
         {
             Console.WriteLine(exception);
             Console.WriteLine("Please try again");
             Console.WriteLine();
             FirstRoundCommand();
         }
     }
     else
     {
         try
         {
             GeneralCommands();
         }
         catch (Exception exception)
         {
             Console.WriteLine(exception);
             Console.WriteLine("Please try again");
             Console.WriteLine();
             GeneralCommands();
         }
     }
 }
Esempio n. 2
0
        public override void NewRoundStarted(GameMap gameState)
        {
            ConsoleRender.RenderToConsolePretty(gameState, playerKey);

            Console.WriteLine("To move, type a,w,s,d and press enter");
            Console.WriteLine("To plant a bomb, type z and enter");
            Console.WriteLine("You can reduce the bomb timer to 1 using x");
            Console.WriteLine();
            Console.WriteLine("Movement for player " + Name);
            var line = System.Console.ReadLine();

            if (line == "w")
            {
                PublishCommand(new MovementCommand(MovementCommand.Direction.Up));
            }
            else if (line == "s")
            {
                PublishCommand(new MovementCommand(MovementCommand.Direction.Down));
            }
            else if (line == "a")
            {
                PublishCommand(new MovementCommand(MovementCommand.Direction.Left));
            }
            else if (line == "d")
            {
                PublishCommand(new MovementCommand(MovementCommand.Direction.Right));
            }
            else if (line == "z")
            {
                PublishCommand(new PlaceBombCommand());
            }
            else if (line == "x")
            {
                PublishCommand(new TriggerBombCommand());
            }
            else
            {
                PublishCommand(new DoNothingCommand());
            }
        }
Esempio n. 3
0
 void engine_RoundComplete(GameMap gameMap, int round)
 {
     ConsoleRender.RenderToConsolePretty(gameMap, 'Z');
 }
Esempio n. 4
0
 private void EngineOnGameStarted(GameMap gameMap)
 {
     ConsoleRender.RenderToConsolePretty(gameMap, 'Z');
 }