Ejemplo n.º 1
0
 public static void StartGame()
 {
     Menu();
     PlayerStart();
     AIStart();
     GridGeneration.UpdateField();
     GridGenerationAI.UpdateFieldAIAndDontShowShips();
 }
Ejemplo n.º 2
0
 public static void TryToCreateShip(int size, int width, int number, int[] height)
 {
     if (CanCreateShip(width, height, size))
     {
         GridGenerationAI.DrawAI(height, width, size);;
     }
     else
     {
         ships[number].state = ShipState.unspawned;
     }
 }
Ejemplo n.º 3
0
        public static void wasHitFromPlayer()
        {
            int playerAttackY = PlayerInteraction.attackHeight;
            int playerAttackX = PlayerInteraction.attackWidth;

            for (int i = 0; i < ShipGenerationAI.ships.Length; i++)
            {
                Ship tempShip = ShipGenerationAI.ships[i];
                if (playerAttackY == tempShip.height[0] && playerAttackX == tempShip.width)
                {
                    ShipGenerationAI.ships[i].state = ShipState.destroyed;
                    GridGenerationAI.Shoot(tempShip.height[0], tempShip.width, '#');
                    UI.WriteASentence(ConsoleColor.Cyan, "You ve hit!");
                    return;
                }
            }
            GridGenerationAI.Shoot(playerAttackY, playerAttackX, '^');
            UI.WriteASentence(ConsoleColor.Cyan, "You havent hit");
        }
Ejemplo n.º 4
0
 public static void Shoot(int height, int width, char bullet)
 {
     Console.Clear();
     UnlockShot(height, width, bullet);
     GridGenerationAI.UpdateFieldAIAndDontShowShips();
     if (bullet == '#')
     {
         EndOfGame.IfPlayerWon();
         if (GameCycle.isgameEnded)
         {
             GameCycle.GameProcess();
         }
         else
         {
             AIInteraction.Attack();
             Logic.wasHittedFromAI();
         }
     }
 }
Ejemplo n.º 5
0
 private static void AIStart()
 {
     GridGenerationAI.GenerateFieldAI();
     ShipGenerationAI.GenerateShip(1, 11);
 }