//Contructor needed for loading DLL file later. public GameMaster() { moveHandler = new PlayerMoveHandler(this, protocol, board); colorOrder = new System.Collections.Generic.List <Game.PlayerColor> () { Game.PlayerColor.White, Game.PlayerColor.Black }; }
private IEnumerator MakePlayerMove() { while (true) { UpdateGameStatus(Constants.PLAYER_MOVE_WAIT); // Let the player make a move yield return(StartCoroutine(Board.WaitForNextMove())); UpdateGameStatus(Constants.PLAYER_MOVE_PROCESSING); // Get and execute the player move var move = Board.GetAndResetMove(); var playerMoveHandler = new PlayerMoveHandler(CurrentPlayer, move); yield return(StartCoroutine(playerMoveHandler.ExecuteRequest())); var makeMoveResult = playerMoveHandler.MoveResult; // If valid move place token and end player move if (makeMoveResult.valid) { UpdateGameStatus(Constants.PLAYER_MOVE_COMPLETED); WinnerStatusText.GetComponent <Text>().enabled = false; Board.PlacePlayerToken(move.row, move.col); yield break; } // Otherwise ask for another move else { UpdateGameStatus(Constants.PLAYER_MOVE_INVALID); } yield return(null); } }