public BoardHistoric Clone() { BoardHistoric tmp = new BoardHistoric(); tmp.bPlayerOneTurn = bPlayerOneTurn; tmp.iTurn = iTurn; tmp.Board = Board.Clone() as int [, ]; tmp.BlackScore = BlackScore; tmp.WhiteScore = WhiteScore; tmp.BlackWin = BlackWin; tmp.WhiteWin = WhiteWin; tmp.winX = winX; tmp.winY = winY; tmp.hasWon = hasWon; return(tmp); }
// Use this for initialization void Awake() { Instance = this; currentState = new BoardHistoric(); if (lBoardHisto != null) { lBoardHisto.Clear(); EatCoord.Clear(); } else { lBoardHisto = new List <BoardHistoric>(); currentState.Board = new int[iHeightBoard, iWidthBoard]; lBoardHisto.Insert(0, currentState.Clone()); EatCoord = new List <int[]>(); } PopUpWinPanel = GameObject.Find("PopUpWin"); PopUpWinPanel.SetActive(false); GameObject tmp = GameObject.Find("DepthScore"); DepthText = tmp.GetComponent <Text>(); tmp = GameObject.Find("ValueScore"); ValueText = tmp.GetComponent <Text>(); tmp = GameObject.Find("TimeScore"); TimeText = tmp.GetComponent <Text>(); currentState.iTurn = 0; currentState.BlackScore = 0; currentState.WhiteScore = 0; currentState.BlackWin = false; currentState.WhiteWin = false; currentState.bPlayerOneTurn = true; for (int i = 0; i < iHeightBoard; i++) { for (int j = 0; j < iWidthBoard; j++) { currentState.Board[i, j] = Stone.Empty; } } }