Hi there, I have a question. I am trying to decrease the size of a GUI.Box on click, and maybe it refills after a couple of seconds. Here is what I have now. I have no idea where to begin:
#pragma strict
var ammo : float;
var fireRate : float = 0.5;
private var nextFire : float = 0.0;
private var shooting : boolean = true;
private var flames : boolean = true;
function OnGUI() {
GUI.color = Color.red;
GUI.Box(Rect(20,200,Screen.width / 5,Screen.height / 20), "" + ammo);
if(Input.GetMouseButtonDown(0) && Time.time > nextFire){
nextFire = Time.time + fireRate;
ammo -= 1;
GUI.Box(new Rect(20,200,Screen.width / 7, Screen.height/20), "");
{
if(ammo < 0)
shooting = false;
flames = false;
yield WaitForSeconds(5);
ammo += 1;
if(ammo > 0)
shooting = true;
flames = true;
}
}
if(shooting == false){
GameObject.Find("Actual").GetComponent(MagicShoot).active = false;
GameObject.Find("small flames").active = false;
}
else
{
GameObject.Find("Actual").GetComponent(MagicShoot).active = true;
GameObject.Find("small flames").active = true;
}
}