Hi ,there!
If that’s not a lot to ask , i wanted to make that if i press the space button once then it needs to be disabled/blocked for like 22 seconds , because the power on and off animation duration is about that much time .
So when the 22 seconds is over then it can be re-enabled so and it’s start over again .
Here is the script so far :
#pragma strict
private var coolingDown;
function Update () {
if (Input.GetButtonDown ("Jump")){
SwitchTrigger();
EndCooldown();
}
if (!coolingDown)
{
coolingDown = true;
Invoke("EndCoolDown", 22.0f);
}
}
function EndCooldown()
{
coolingDown = false;
}
function SwitchTrigger() {
renderer.enabled = true;
collider.enabled = true;
animation.Play("Shield_On");
yield WaitForSeconds(10);
animation.Play("Shield_Low");
yield WaitForSeconds(2);
renderer.enabled = false;
collider.enabled = false;
}
I hope that everything is clear, and thanks in advance