We will create a new class, deriving it from Board, override its parent's methods, and create new ones:
- Create the BoardTicTac class, deriving it from Board, and add the corresponding member variables for storing the board's values:
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; public class BoardTicTac : Board { protected int[,] board; protected const int ROWS = 3; protected const int COLS = 3; }
- Implement the default constructor:
public BoardTicTac(int player = 1) { this.player = player; board = new int[ROWS, COLS]; board[1,1] = 1; }
- Define the function for retrieving the next player in turn:
private int GetNextPlayer(int p) { if (p == 1) return 2; return 1; }
- Create ...