Game Development Reference
In-Depth Information
[System.Serializable]
public class popupData
{
public GameObject obj; // a potential
GameObject to operate on
public int id; //an integer id to use
when processing a popup
public string name;//a string to use
when processing a popup
}
15. We keep a list of actions (pop-up response classes) that will be invoked on
a click on each button. This is kept as an array and not as a single response
so that a button can perform an arbitrary number of tasks on a click.
public list<popupResponse> actions;
16. We create an enumeration for the current state of the button. This will be
used to codify whether or not the mouse pointer is over the button and wheth-
er we should display the highlighted or non-highlighted texture:
public enum eButtonState
{
Invalid = -1,
Off = 0,
On = 1 // a tri state enum used to
encode if a button is clicked or not
};
17. We keep two variables of the eButtonState type. The ButtonState vari-
able represents the current eButtonState of the button; namely, if it is On
or Off . The PrevTickButtonState variable stores the ButtonState for
every frame that the button itself updates. We use two state variables to
search for the frame where the state changes so that we can dispatch the
button actions on that frame:
Public eButtonState ButtonState;
Public eButtonSTate prevTickButtonState;
Search WWH ::




Custom Search