I’m making a miniagme, were, you can shoot. I use this Firerate stript, and I don’t know why it doesn’t work: the scene start, I shot one time, and the x become equal to 0.511. I don’t know why it doens’t works!
can you help me please?
this is an example, like my real script:
#pragma strict
var spownPoint : Transform;
var bullet : GameObject;
var bool : boolean;
var force : int=1000;
var x : GameObject;
var z : float;
var y :float;
function Start ()
{
}
function Update ()
{
if(Input.GetKey(KeyCode.E)&&Time.deltaTime>z)
{
z = Time.deltaTime+y;
shot();
}
}
function shot()
{
var x = Instantiate(bullet, spownPoint.position, spownPoint.rotation);
x.GetComponent.<Rigidbody>().AddForce(x.transform.forward*forza);
}