예제 #1
0
    ////////////////////////////////////////////////////////////////////////////
    /// 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);
    }
예제 #2
0
    // 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);
    }
예제 #3
0
 public static BoardCellState GetStartingPlayer()
 {
     startingPlayer = startingPlayer.Opponent();
     return(startingPlayer);
 }