//////////////////////////////////////////////////////////////////////////// /// Game Logic //////////////////////////////////////////////////////////////////////////// // Return a board where the player on turn moved to (i,j). // Return null if the move is not to an empty cell. // Does not check if the move is otherwise invalid. Board SimulateMove(int i, int j) { // check if the cell is empty if (board[i, j] != BoardCellState.Empty) { throw new Exception("The move destination cell is not empty!"); } //return null; // create a new board and place the player on (i,j) Board nextBoard = new Board(this); nextBoard.board[i, j] = playerOnTurn; nextBoard.playerOnTurn = playerOnTurn.Opponent(); // convert neighbours ForEachCellNeighbour(i, j, (int ii, int jj) => { if (board[ii, jj] == playerOnTurn.Opponent()) { nextBoard.board[ii, jj] = playerOnTurn; } }); // fill closed spaces nextBoard.FillClosedAreas(); return(nextBoard); }
// convert bacteria public void Convert() { state = state.Opponent(); animator.SetInteger("Player", playerAnimId[(int)state]); PlayAnimation("Convert"); GlobalAnimationTimer.AnimationTriggered(convertAnimationClip); // play audio MusicManagerSingleton.Instance.playSound(popAudio, audio); }
public static BoardCellState GetStartingPlayer() { startingPlayer = startingPlayer.Opponent(); return(startingPlayer); }