I've got a beanbag toss game that has rounds, players, and then each player gets 3 tosses before going on to the next player.
I need to set a boolean, tossed = false, until the player tosses the beanbag. While this is false, I need to display some GUI elements such as input boxes and a button to toss but until they have hit the button I do not want to increment tossNo, playerNo, or roundNo.
function OnGUI(){
for (roundNo = 1; roundNo <=3; roundNo++) //start of the round
{
tossed = false;
for (var playerNo: int = 1; playerNo <= noPlayers; playerNo ++) //start of the player's turn
{
for (tossNo =1 ; tossNo <= 3; tossNo ++)
{
tossed = false; //put in x and y vel
}//we need it to wait here and poll the Toss It button without incrementing
}
if (GUI.Button (Rect (140,100,80,20), "Toss It")) tossed = true;
}