public bool isTeamOnEchec(team team) { team otherTeam = (team == team.WHITE) ? team.BLACK : team.WHITE; Roi king = _kings[(int)team]; foreach (Piece ennemy in _teamPieces[(int)otherTeam]) { if (ennemy.alive == true) { int dX = (int)king.x - (int)ennemy.x; int dZ = (int)king.z - (int)ennemy.z; if (ennemy.team == team.WHITE) { dZ *= -1; } if (ennemy.canMoveOf(dX, dZ, false)) { king.GetComponent <Highlight>().on(new Color32(191, 10, 10, 255)); ennemy.GetComponent <Highlight>().on(new Color32(184, 87, 0, 255)); return(true); } } } return(false); }