private bool[,] GetAllEnemyMoves(List <GameObject> enemies) { List <bool[, ]> listMoves = new List <bool[, ]>(); foreach (GameObject go in enemies) { if (go != null) { Chessman chessman = go.GetComponent <Chessman>(); if (chessman.isWhite != isWhite) { listMoves.Add(chessman.PossibleEat()); } } } bool[,] result = new bool[8, 8]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { foreach (bool[,] moves in listMoves) { if (moves[i, j]) { result[i, j] = true; break; } } } } return(result); }