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))
     {
         GridGeneration.Draw(height, width, size);;
     }
     else
     {
         ships[number].state = ShipState.unspawned;
     }
 }
Ejemplo n.º 3
0
        public static void wasHittedFromAI()
        {
            int AIAttackY = AIInteraction.attackHeight;
            int AIAttackX = AIInteraction.attackWidth;

            for (int i = 0; i < ShipGeneration.ships.Length; i++)
            {
                Ship tempShip = ShipGeneration.ships[i];
                if (AIAttackY == tempShip.height[0] && AIAttackX == tempShip.width)
                {
                    ShipGeneration.ships[i].state = ShipState.destroyed;
                    GridGeneration.Shoot(AIAttackY, AIAttackX, '#');
                    UI.WriteASentence(ConsoleColor.Cyan, "Enemy hit!");
                    return;
                }
            }
            GridGeneration.Shoot(AIAttackY, AIAttackX, '^');
            UI.WriteASentence(ConsoleColor.Cyan, "Enemy havent hit");
        }
Ejemplo n.º 4
0
        public static void Shoot(int height, int width, char bullet)
        {
            GridGeneration.UpdateField();
            UnlockShot(height, width, bullet);

            if (bullet == '#' && !GameCycle.isgameEnded)
            {
                EndOfGame.IfPlayerWon();
                if (GameCycle.isgameEnded)
                {
                    GameCycle.GameProcess();
                }
                else
                {
                    PlayerInteraction.Attack();
                    Logic.wasHitFromPlayer();
                }
            }
        }
Ejemplo n.º 5
0
 private static void PlayerStart()
 {
     GridGeneration.GenerateField();
     ShipGeneration.GenerateShip(1, 11);
 }