Time for action – finish creating the game
Let us finish the creation of our game by creating an opening screen. We will then add some checks to stop players from selecting squares more than once. Follow that with a check to see if anyone won and finally display a game over screen. With that, the game will be ready for us to make it look great.
Let's perform the following steps for finishing our game:
- We will do all this by first creating another script like our
SquareState
script. Create the newGameState
script and clear out the default contents. Add the following code snippet and we will have the values needed to track the current state of our game:public enum GameState { Opening, MultiPlayer, GameOver }
- We now need to update our
TicTacToeControl
script. For starters, because we want to be able to play multiple games, add theNewGame
function to the script. This function initializes our control variables so that we can start a fresh game with a clear board. It will not...