示例#1
0
        public void ResetHistory()
        {
            gameHistory.Clear();
            TurnDetails td = new TurnDetails(); //we need to set up the BASE turn, for history reverting.

            td.player      = StoneColor.white;  //black plays first. Which means the "previous" turn was white. So it sets the "next" turn to black, by returning white. (its dumb, dont judge me)
            td.gameState   = new int[0];        //empty! But we can "check" it and count that there are 0 stones at this state, and not throw an erorr.
            gameHistory[0] = td;
            turnNumber     = 1;
        }
示例#2
0
 public void Undo()
 {
     Debug.Log("undo to " + (gsi.turnNumber - 2));
     if (gsi.turnNumber > 1)//1 is when the first turn.
     {
         TurnDetails turn = history.GetTurnDetials(gsi.turnNumber - 2);
         gsi.currentTurn = OtherColor(turn.player);
         RevertToPreviousTurn(gsi.turnNumber - 2);
         gsi.turnNumber = gsi.turnNumber - 1;
     }
 }
示例#3
0
        public void AddToHistory(int turnNumber, Stone s, int stonesCaptued, int[] gameState, BoardSetup board)
        {
            TurnDetails turnDetails = new TurnDetails();

            turnDetails.turnNumber             = turnNumber;
            turnDetails.player                 = s.color;
            turnDetails.stonesCapturedThisTurn = stonesCaptued;
            turnDetails.playPosition           = s.position;
            turnDetails.columnAsLetter         = GetColumnLetter((int)s.position.x);
            turnDetails.rowAsNumber            = (int)s.position.x + 1;
            turnDetails.gameState              = gameState;
            gameHistory[turnNumber]            = turnDetails;
        }