Game Development Reference
In-Depth Information
GUI.Label(r_weaponLabel, gui_weaponCon, "Text Item");
GUI.Label(r_armorLabel, gui_armorCon, "Text Item");
GUI.Label(r_accessLabel, gui_accessCon, "Text Item");
GUI.Label(r_skillTexture, gui_skillCon, "Text Item");
}
6. Before we inish this step, we need to add another funcion, checkmax() , to
the preceding code. This funcion will make sure that the maximum number of
atributes is not over the limit. Let's add the code to create this funcion:
private function CheckMax () : void {
fullHP = Mathf.Clamp(fullHP, 0.0, maxHP);
fullMP = Mathf.Clamp(fullMP, 0.0, maxMP);
currentHP = Mathf.Clamp(currentHP, 0.0, fullHP);
currentMP = Mathf.Clamp(currentMP, 0.0, fullMP);
currentLV = Mathf.Clamp(currentLV, 0.0, maxLV);
currentEXP = Mathf.Clamp(currentEXP, 0.0, maxEXP);
currentNEXT = Mathf.Clamp(currentNEXT, 0.0, maxNEXT);
currentATK = Mathf.Clamp(currentATK, 0.0, maxATK);
currentDEF = Mathf.Clamp(currentDEF, 0.0, maxDEF);
currentAGI = Mathf.Clamp(currentAGI, 0.0, maxAGI);
currentINT = Mathf.Clamp(currentINT, 0.0, maxINT);
currentLUC = Mathf.Clamp(currentLUC, 0.0, maxLUC);
}
7. Now, we go back to Unity, click play , and press the M key to bring up our menu window.
We will see all the atributes for our character, as shown in the following screenshot:
 
Search WWH ::




Custom Search