public void StartGame() { SettingGame PlayeGame = new SettingGame(sizeField, gameMode); if (sizeField == 0) { PlayeGame.DefoltGame(); } // PlayeGame.ShowSetting(); //генерирует сетку PlayeGame.GridGeneration(); _GamePlay.GetComponent <GamePlay>().ClearPos(); //раставляет префабы GenerationGrid(PlayeGame.GetPointGrid); //стартует игру _GamePlay.GetComponent <GamePlay>()._SizeMap = PlayeGame.GetSizeViled; _GamePlay.GetComponent <GamePlay>().SetClearPosActive(PlayeGame.GetPointGrid); _GamePlay.GetComponent <GamePlay>().SetChessMove = (Random.Range(0, 2) == 0)?true:false; _GamePlay.GetComponent <GamePlay>().GameMode = gameMode; }
public WriteTransWin(VocabularyContext vocabularyContext, User user) { InitializeComponent(); currentUser = user; _vocabularyContext = vocabularyContext; words = UserVocabulary(_vocabularyContext.Vocabularies.ToList()); settingGame = new SettingGame(_vocabularyContext); gameController = new GameController(); tm = new TimerCallback(gameController.TimerOver); currentPoints = 0; StartGame(); }
public OneFromTheFouthWin(VocabularyContext vocabularyContext, User user) { InitializeComponent(); currentUser = user; _vocabularyContext = vocabularyContext; words = UserVocabulary(_vocabularyContext.Vocabularies.ToList()); //settingGame = new SettingGame(_vocabularyContext); gameController = new GameController(); tm = new TimerCallback(gameController.TimerOver); currentPoints = 0; buttons = InittializeButton(); settingGame = new SettingGame(_vocabularyContext); StartGame(); }
static void Main(string[] args) { var Menu = true; //Setting The Game //Main Menu while (Menu) { int choice; var consoleKey = MainMenu.GetConsoleKey(); if (consoleKey.Key == ConsoleKey.Escape) { break; } else if (int.TryParse(consoleKey.KeyChar.ToString(), out choice) == false || consoleKey.Key == ConsoleKey.H) { continue; } Console.Clear(); //Setting the Board var board = SettingGame.GetBoard(choice); //Declaring Which Main Class (Action Handler Class : IPawnActionHandler(Implemetation)) I Want To Execute With Gameplay Class!!! var GamePlay = new GamePlay(new PawnActionHandler()); var GameOn = true; //Plyer Request = User Input and Current Board var playerRequest = new PlayerRequest(); //The Game Started while (GameOn) { //Printing The Board DisplayBoard.Display(board); //The Player Enters Input var playerinput = GameInput.GetPlayerInput(board); if (playerinput.Equals(false)) { Thread.Sleep(2000); Console.Clear(); break; } //If The Player Couldn't Play Because The Input Wasn't Good To Play a Turn (Move or Eat a Pawn) it will equals to true var anotherTurn = true; playerRequest.MovementInput = (Input)playerinput; playerRequest.Board = board; //The player Try to Move if (GameActions.Move(playerRequest, board, GamePlay) == true) { anotherTurn = false; } //The Player Try to Eat else { Console.WriteLine("\nUnssucceful Move...\n"); Thread.Sleep(2000); if (GameActions.Eat(playerRequest, board, GamePlay) == true) { anotherTurn = false; } else { Console.WriteLine("\nUnsuccessful First Eat Move...\n"); Thread.Sleep(2000); } } //The Player Didn't Success To Move or to Eat if (anotherTurn == true) { continue; } //Check If The Pawns Neeeds To Change (Type) ChangeTypes.ChangeTheTypes(board); //Exit?? If Someone lost all of his pawns if (Exit.ExitCheck() == true) { GameOn = false; continue; } //Current Color Turn board.CurrentTurn = Colors.ChangeTheColor(board.CurrentTurn); //Save Game??? //if (SettingGame.SaveGame(board) == true) // GameOn = false; //Console.WriteLine($"\nBlack Pawns = {SettingGame.BlackPawnsAlive.Count}\nWhite Pawns = {SettingGame.WhitePawnsAlive.Count}\n"); } } }
static void GameMenu(User currentUser) { UsefulFunctions.PrepareForView(); GameController gameController = new GameController(); int currentPoints = 0; byte gameChoose = UsefulFunctions.Choose(_gameMenu); SettingGame settingGame = new SettingGame(_vocabularyContext); switch (gameChoose) { case 1: { if (_vocabularyContext.Vocabularies.ToList().Count < GameController.MIN_COUNT) { Console.WriteLine("Count of words less than {0}", GameController.MIN_COUNT); } else { TimerCallback tm = new TimerCallback(gameController.TimerOver); Timer timer = new Timer(tm, null, GameController.TIMER_MILISECONDS, -1); while (!gameController.isTimerOver) { UsefulFunctions.PrepareForView(); int translation = GameController.FOREIGN_TRANSLATION; Vocabulary getRow = gameController.ChooseRandomRow( _vocabularyContext.Vocabularies.ToList(), ref translation); string word; _ = translation == GameController.FOREIGN_TRANSLATION ? word = getRow.ForeignWord : (word = getRow.LocalWord); Console.WriteLine("Write the translation to {0}", word); string result = Console.ReadLine(); if (gameController.Checker(getRow, result, translation)) { currentPoints += settingGame.countPoints; } } Console.WriteLine("Count of points is {0}", currentPoints); GameController.WriteToTable(currentPoints, currentUser, null); Console.ReadLine(); } } break; case 2: { } break; case 4: { } break; case 5: break; default: break; } }