public static void StartGame() { Menu(); PlayerStart(); AIStart(); GridGeneration.UpdateField(); GridGenerationAI.UpdateFieldAIAndDontShowShips(); }
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; } }
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"); }
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(); } } }
private static void AIStart() { GridGenerationAI.GenerateFieldAI(); ShipGenerationAI.GenerateShip(1, 11); }