I was making the pick up props can increase the time that in the countdown of the script , but I don`t know how to pick up an object then increase time. I hope anybody can help me.thanks.
var myRect : Rect;
var myText : Texture;
function Start()
{ myRect = Rect(0,0,256,32);
}
function Update()
{
// Example way to change bar length
myRect.width -= Time.deltaTime;
if (myRect.width < 0) {
myRect.width = 0;
}
}
function OnGUI()
{
GUI.DrawTexture(myRect, myText);
}
And how can i change the increase Value like increase 10 in onetime?the script is from the tutorials.
static var Count : int = 0;
var CollectSound : AudioClip;
function OnControllerColliderHit(hit:ControllerColliderHit){
if(hit.gameObject.tag == "gem"){
Destroy(hit.gameObject);
//this adds 1 to the variable called 'Count'
Count++; audio.PlayOneShot(CollectSound);
}
}