Game Development Reference
In-Depth Information
"I"))
{
SetNewKey(PreviousKey, orig_pcInv);
ShowPopup = false;
}
if(GUI.Button(new Rect(150, 250, 135, 20),
"Escape"))
{
SetNewKey(PreviousKey, orig_pcPause);
ShowPopup = false;
}
if(GUI.Button(new Rect(325, 225, 135, 20), "A
Button"))
{
SetNewKey(PreviousKey, orig_xInv);
ShowPopup = false;
}
if(GUI.Button(new Rect(325, 250, 135, 20),
"Start Button"))
{
SetNewKey(PreviousKey, orig_xPause);
ShowPopup = false;
}
GUI.EndGroup();
}
When the player clicks on one of these new buttons, the SetNewKey function is
called. When called, we pass PreviousKey , which is the key the player is custom-
izing, as well as the key they select, which is the new value of PreviousKey . This
is a great and simple way to change controls, which makes it simple for the player.
Resetting the controls
In this section, we will add the ability to allow the player to reset the controls to their
default values.
Search WWH ::




Custom Search