Ejemplo n.º 1
0
 public void LoadGameState()
 {
     ResetGame();
     if (PlayerPrefs.HasKey("Board"))
     {
         string prefString = PlayerPrefs.GetString("Board");
         board = StringToIntList(prefString).ToArray();
         for (int i = 0; i < actualBoard.Length; i++)
         {
             BoxScript boardControl = actualBoard[i].GetComponent <BoxScript>();
             if (board[i] == -1)
             {
                 boardControl.TouchBox();
                 moveCount++;
             }
             else if (board[i] == 1)
             {
                 boardControl.ComputerTouch();
             }
             else
             {
                 boardControl.Reset();
             }
         }
     }
     else
     {
         print("No board to load!");
     }
 }