public void MakeMove(TinySpot spot) { spot.MakeMark(currentTurn); spot.Board.MadeMove(spot); // check if this ends the game bigBoard.CheckWinner(); if(bigBoard.Winner != SpotValue.None) { switch(bigBoard.Winner) { case SpotValue.X: Debug.Log("Game Over, X won!"); break; case SpotValue.O: Debug.Log("Game Over, O won!"); break; case SpotValue.Tie: Debug.Log("Game Over, TIED!"); break; } isPlaying = false; } else { // find the next forced board int index = spot.Board.GetIndex(spot); TinyBoard targetBoard = bigBoard.GetSpot(index) as TinyBoard; forcedBoard = targetBoard; // but don't force it if it's already completed if(targetBoard.Winner != SpotValue.None) { forcedBoard = null; } highlight.Highlight(currentTurn, spot, targetBoard, targetBoard == forcedBoard); // next turn is opposite player's if(currentTurn == SpotValue.X) { currentTurn = SpotValue.O; } else { currentTurn = SpotValue.X; } } }
public void Start() { board = transform.parent.GetComponent<TinyBoard>(); }