I want my code to be, if Combatstyle = 1, than CombatStyleName = “Melee”
But I don’t know what I am doing wrong with my code.
Please help.
Thank you.
#pragma strict
var skills = false;
var abilities = false;
var faith = false;
var inventory = false;
var equipment = false;
var spells = false;
static var CombatStyle = 0;
var CombatStyleName = "";
function Awake(){
CombatStyle = 1;
}
function Update(){
if (Input.GetKeyDown (KeyCode.Tab)){
CombatStyle++;
}
if(CombatStyle == 5){
CombatStyle = 1;
}
if(CombatStyle == 1){
CombatStyleName = "Melee";
}
if(CombatStyle == 2){
CombatStyleName = "Range";
}
if(CombatStyle == 3){
CombatStyleName = "Holy Magic";
}
if(CombatStyle == 4){
CombatStyleName = "Unholy Magic";
}
}
function OnGUI () {
if(GUI.Button (Rect (1140, 250, 75, 20), "Skills")){
skills = true;
abilities = false;
faith = false;
inventory = false;
equipment = false;
spells = false;
}
if(GUI.Button (Rect (1220, 250, 75, 20), "Abilities")){
skills = false;
abilities = true;
faith = false;
inventory = false;
equipment = false;
spells = false;
}
if(GUI.Button (Rect (1300, 250, 75, 20), "Faith")){
skills = false;
abilities = false;
faith = true;
inventory = false;
equipment = false;
spells = false;
}
if(GUI.Button (Rect (1140, 280, 75, 20), "Inventory")){
skills = false;
abilities = false;
faith = false;
inventory = true;
equipment = false;
spells = false;
}
if(GUI.Button (Rect (1220, 280, 75, 20), "Equipment")){
skills = false;
abilities = false;
faith = false;
inventory = false;
equipment = true;
spells = false;
}
if(GUI.Button (Rect (1300, 280, 75, 20), "Spells")){
skills = false;
abilities = false;
faith = false;
inventory = false;
equipment = false;
spells = true;
}
if(skills == true){
GUI.Box (Rect (1140, 305, 230, 700), "Skills!");
GUI.Label (Rect (1160, 325, 100, 20), "Attack");
GUI.Label (Rect (1150, 345, 1000, 20), "Current Level : " +Attack.curLevel);
GUI.Label (Rect (1150, 365, 1000, 20), "Current EXP : " +Attack.curExp);
GUI.Label (Rect (1150, 385, 1000, 20), "EXP to level : " +Attack.expLeft);
GUI.Label (Rect (1160, 415, 100, 20), "Range");
GUI.Label (Rect (1150, 435, 1000, 20), "Current Level : " +Range.curLevel);
GUI.Label (Rect (1150, 455, 1000, 20), "Current EXP : " +Range.curExp);
GUI.Label (Rect (1150, 475, 1000, 20), "EXP to level : " +Range.expLeft);
GUI.Label (Rect (1160, 505, 100, 20), "Holy Mage");
GUI.Label (Rect (1150, 525, 1000, 20), "Current Level : " +Holymage.curLevel);
GUI.Label (Rect (1150, 545, 1000, 20), "Current EXP : " +Holymage.curExp);
GUI.Label (Rect (1150, 565, 1000, 20), "EXP to level : " +Holymage.expLeft);
GUI.Label (Rect (1160, 595, 100, 20), "Unholy Mage");
GUI.Label (Rect (1150, 615, 1000, 20), "Current Level : " +Unholymage.curLevel);
GUI.Label (Rect (1150, 635, 1000, 20), "Current EXP : " +Unholymage.curExp);
GUI.Label (Rect (1150, 655, 1000, 20), "EXP to level : " +Unholymage.expLeft);
GUI.Label (Rect (1150, 685, 100, 20), "Combat Style : " +CombatStyleName);
}
if(abilities == true){
GUI.Box (Rect (1140, 305, 230, 700), "Abilities!");
}
if(faith == true){
GUI.Box (Rect (1140, 305, 230, 700), "Faith!");
}
if(inventory == true){
GUI.Box (Rect (1140, 305, 230, 700), "Inventory!");
}
if(equipment == true){
GUI.Box (Rect (1140, 305, 230, 700), "Equipment!");
}
if(spells == true){
GUI.Box (Rect (1140, 305, 230, 700), "Spells!");
}
}