private bool CheckAllHorseofPlayer(int playerNumber, int diceNumber) { int cnt = 0; int squareMaxPlayer = (playerNumber - 1) * 12 + 48; // o toi da co the den cua playerNumber for (int i = 1; i <= 4; i++) { Horse horse = player[playerNumber].getHorse(i); if (horse.Check_trong_chuong()) { continue; } if (horse.GetChuongUnder() != 0) { continue; } horse.SetCanRun(2); int squareUnder = horse.GetSquareUnder(); if (playerNumber == 2 && 1 <= squareUnder && squareUnder <= 12) { squareUnder += 48; } if (playerNumber == 3 && 1 <= squareUnder && squareUnder <= 24) { squareUnder += 48; } if (playerNumber == 4 && 1 <= squareUnder && squareUnder <= 36) { squareUnder += 48; } Debug.Log(squareUnder.ToString()); if (squareUnder + diceNumber > squareMaxPlayer && squareUnder < squareMaxPlayer) { horse.SetCanRun(0); } else { for (int j = squareUnder + 1; j <= diceNumber + squareUnder - 1; j++) { //int k = (j - 1) % 48 + 1;// fix vuot qua gioi han 48 o if (square[(j - 1) % 48 + 1].GetPlayerOnThisSquare() != 0) // neu tren o nay co con ngua dang dung { Debug.Log(i.ToString() + "bi chan"); horse.SetCanRun(0); break; } } } if (square[(squareUnder + diceNumber - 1) % 48 + 1].GetPlayerOnThisSquare() == playerNumber) { horse.SetCanRun(0); } if (squareUnder == squareMaxPlayer) // kiem tra di chuyen o o toi da cua player { horse.SetCanRun(3); for (int j = 1; j <= diceNumber; j++) { if (chuongDich[playerNumber, j].HasHorse()) { horse.SetCanRun(0); } } } } Debug.Log(cnt); for (int i = 1; i <= 4; i++) { if (player[playerNumber].getHorse(i).GetCanRun() > 0) { return(true); } } return(false); }