I’m having trouble implementing chess promotion. When a pawn advances to the final row it can be promoted. My program has a panel pop up with buttons for the user to select the pawn’s promotion. The Queen button calls this function
public void ChoseQueen() {
Debug.Log("Chose Q");
Chess.Promote('Q');
}
Chess.Promote does this
char promoteSelection = ' ';
public void Promote(char promoteToThis) {
promoteSelection = promoteToThis;
}
I need to wait once a pawn arrives at the last row for the user to press a button.
I need something like the following pseudocode:
while (promoteSelection == ' ' ) {
Debug.Log("Waiting for button press");
sleep(1000);
}
Debug.Log("Pawn promotion button pressed!");
How to wait for a button press ? What would be the best way to do pawn promotion?