27-08-2015, 07:29 PM
si,ecco
function Update ()
{
nemico = GameObject.FindWithTag("Nemico");
transform.LookAt(nemico.transform);
if(on && Vector3.Distance(nemico.transform.position, transform.position)<distanza)
{
Sparo();
on = false;
}
}
function Sparo ()
{
var Bullet : GameObject = Instantiate(colpo, SpawnBullet.position, SpawnBullet.rotation);
Bullet.rigidbody.AddForce (SpawnBullet.forward * Forza);
yield WaitForSeconds (TempoRicarica);
on = true;
}
function Update ()
{
nemico = GameObject.FindWithTag("Nemico");
transform.LookAt(nemico.transform);
if(on && Vector3.Distance(nemico.transform.position, transform.position)<distanza)
{
Sparo();
on = false;
}
}
function Sparo ()
{
var Bullet : GameObject = Instantiate(colpo, SpawnBullet.position, SpawnBullet.rotation);
Bullet.rigidbody.AddForce (SpawnBullet.forward * Forza);
yield WaitForSeconds (TempoRicarica);
on = true;
}