This will most probably have a stupidly easy explanation but I can’t get my head around this, I have a piece of code to create a simple GUI for holding a players level and experience:
#pragma strict
var currentXP : int = 0;
var maxXP : int = 500;
var XPtext : GUIText;
var Level : int = 1;
function Update ()
{
XPtext.text = "Level " + Level + " XP " + currentXP + " / " + maxXP;
if(currentXP == maxXP)
//if(Input.GetKeyDown("r"))
//currentXP += 10;
{
LevelUpSystem ();
}
}
function LevelUpSystem ()
{
currentXP = 0;
maxXP = maxXP + 50;
Level ++;
}
I want to know how to incorporate this into the update function properly:
//if(Input.GetKeyDown("r"))
//currentXP += 10;
Thanks!