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)) { GridGeneration.Draw(height, width, size);; } else { ships[number].state = ShipState.unspawned; } }
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"); }
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(); } } }
private static void PlayerStart() { GridGeneration.GenerateField(); ShipGeneration.GenerateShip(1, 11); }