Game Development Reference
In-Depth Information
readonly Rect STAT_BOX_RECT = new Rect (237, 67, 360,
147);
readonly Rect WEAPON_BOX_RECT = new Rect (237, 230,
360, 207);
readonly Rect WEAPON_LABEL_RECT = new Rect (252, 264,
180, 40);
readonly Rect ARMOR_LABEL_RECT = new Rect (252, 324,
180, 40);
readonly Rect ACCESS_LABEL_RECT = new Rect (252, 386,
180, 40);
readonly Rect SKILL_TEX_RECT = new Rect (464, 288,
119, 117);
readonly Rect SKILL_BOX_RECT = new Rect (460, 284,
127, 125);
void Start () {
We basically created variables for the Rect positions for each UI texture and text
labels for each attribute.
2. Next, we will create a new function in this menu script after the DoMyWin-
dow() function and call it CheckMax() , which will limit the maximum and
minimum values of the attributes that are highlighted in the following code.
// Unity JavaScript user:
private function DoMyWindow (windowID : int) : void {
}
private function CheckMax () : void {
fullHP = Mathf.Clamp(fullHP, 0, MAX_HP);
fullMP = Mathf.Clamp(fullMP, 0, MAX_MP);
currentHP = Mathf.Clamp(currentHP, 0, fullHP);
currentMP = Mathf.Clamp(currentMP, 0, fullMP);
currentLV = Mathf.Clamp(currentLV, 0, MAX_LV);
currentEXP = Mathf.Clamp(currentEXP, 0, MAX_EXP);
currentNEXT = Mathf.Clamp(currentNEXT, 0, MAX_NEXT);
currentATK = Mathf.Clamp(currentATK, 0, MAX_ATK);
currentDEF = Mathf.Clamp(currentDEF, 0, MAX_DEF);
Search WWH ::




Custom Search