public EndGame(GamePole pole) { this.pole = pole; Console.WriteLine(" Это конец игры , спасибо что доиграли до конца )\n"); pole.ShowState(); System.Threading.Thread.Sleep(5000); Console.WriteLine("Хотите начать новую игру? \nЕсли да то нажмите \"s\" , если нет \"e\" "); }
public void EndGameGenerationTest() { Game game = new Game(new StartMenu()); Robots robot = new WorkingCreator().Create(); GamePole pole = new GamePole(game, robot); EndGame endGame = new EndGame(pole); Assert.AreEqual(endGame.pole, pole); }
public void GameProcessGenerationTest() { Game game = new Game(new StartMenu()); Robots robot = new WorkingCreator().Create(); GamePole pole = new GamePole(game, robot); GameProcess gameProcess = new GameProcess(robot, pole); Assert.AreEqual(gameProcess.pole, pole); Assert.AreEqual(gameProcess.robot, robot); Assert.AreNotEqual(gameProcess.controller, null); }
void RefreshHels() { int L = 0; for (int I = 0; I < 20; I++) { HelsBar[I].GetComponent <Chanks>().Index = 0; } if (GamePole != null) { L = GamePole.GetComponent <GamePole>().LifeShip(); } for (int I = 0; I < L; I++) { HelsBar[I].GetComponent <Chanks>().Index = 1; } }
public void GenerateNewGame() { Random rnd = new Random(); int random = rnd.Next(10); if (random < 5) { Robot = new WorkingCreator().Create(); } else if (random > 7) { Robot = new SmartCreator().Create(); } else { Robot = new CyborgCreator().Create(); } Console.WriteLine("Вам выпал робот: " + Robot.fullHero); //GamePole = new GamePole(); GameHistory = new GameHistory(); pole = new GamePole(this, Robot); }
public GamePoleRestoreCommand(GamePole b) { GamePole = b; }
public GamePoleSaveCommand(GamePole b) { GamePole = b; }
public GamePoleMoveRightCommand(GamePole b) { GamePole = b; }
public GamePoleMoveUpCommand(GamePole b) { GamePole = b; }
public GameProcess(Robots robot, GamePole pole) { this.robot = robot; this.pole = pole; controller = new GamePoleController(new GamePoleMoveUpCommand(pole), new GamePoleMoveDownCommand(pole), new GamePoleMoveRightCommand(pole), new GamePoleMoveLeftCommand(pole), new GamePoleSaveCommand(pole), new GamePoleRestoreCommand(pole)); }
public GamePoleMoveLeftCommand(GamePole b) { GamePole = b; }
public GamePoleMoveDownCommand(GamePole b) { GamePole = b; }
void OnGUI() { float CenterScreenX = Screen.width / 2; float CenterScreenY = Screen.height / 2; Rect LocationButton; //get the playing field GamePole PlayerPoleControl = PlayerPole.GetComponent <GamePole>(); Camera cam; switch (GameMode) { case 0: cam = GetComponent <Camera>(); cam.orthographicSize = 8; this.transform.position = new Vector3(0, 0, -10); LocationButton = new Rect(new Vector2(CenterScreenX - 150, CenterScreenY - 50), new Vector2(300, 200)); GUI.Box(LocationButton, ""); LocationButton = new Rect(new Vector2(CenterScreenX - 40, CenterScreenY - 40), new Vector2(200, 30)); GUI.Label(LocationButton, " Game Menu"); LocationButton = new Rect(new Vector2(CenterScreenX - 100, CenterScreenY), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Start")) { GameMode = 1; } LocationButton = new Rect(new Vector2(CenterScreenX - 100, CenterScreenY + 40), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Exit")) { Application.Quit(); } break; case 1: cam = GetComponent <Camera>(); cam.orthographicSize = 8; this.transform.position = new Vector3(30, 0, -10); LocationButton = new Rect(new Vector2(CenterScreenX - 150, 0), new Vector2(300, 200)); GUI.Box(LocationButton, ""); LocationButton = new Rect(new Vector2(CenterScreenX - 20, 10), new Vector2(200, 30)); GUI.Label(LocationButton, "Options"); LocationButton = new Rect(new Vector2(CenterScreenX - 100, 50), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Back to Menu")) { PlayerPoleControl.ClearPole(); GameMode = 0; } LocationButton = new Rect(new Vector2(CenterScreenX - 100, 90), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Place ships")) { PlayerPoleControl.EnterRandomShip(); } if (PlayerPoleControl.LifeShip() == 20) { LocationButton = new Rect(new Vector2(CenterScreenX - 100, 130), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Battle")) { GameMode = 3; PlayerPole.GetComponent <GamePole>().CopyPole(); ComputerPole.GetComponent <GamePole>().EnterRandomShip(); } } break; case 3: this.transform.position = new Vector3(30, -30, -10); cam = GetComponent <Camera>(); cam.orthographicSize = 14; break; case 4: this.transform.position = new Vector3(120, 0, -10); LocationButton = new Rect(new Vector2(CenterScreenX - 150, 0), new Vector2(300, 200)); GUI.Box(LocationButton, ""); LocationButton = new Rect(new Vector2(CenterScreenX - 10, 10), new Vector2(200, 30)); GUI.Label(LocationButton, "Menu"); LocationButton = new Rect(new Vector2(CenterScreenX - 100, 50), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Back to Menu")) { PlayerPoleControl.ClearPole(); GameMode = 0; } break; case 5: this.transform.position = new Vector3(70, 0, -10); LocationButton = new Rect(new Vector2(CenterScreenX - 150, 0), new Vector2(300, 200)); GUI.Box(LocationButton, ""); LocationButton = new Rect(new Vector2(CenterScreenX - 10, 10), new Vector2(200, 30)); GUI.Label(LocationButton, "Menu"); LocationButton = new Rect(new Vector2(CenterScreenX - 100, 50), new Vector2(200, 30)); if (GUI.Button(LocationButton, "Back to Menu")) { PlayerPoleControl.ClearPole(); GameMode = 0; } break; } }