každé tři vteřiny vznikne nová želva #javascript #unity3d
#pragma strict
public var rocketPrefab : Rigidbody;
public var barrelEnd : Transform;
public var countdown : float = 3f;
function Update ()
{ countdown -= Time.deltaTime;
if(countdown <= 0.0f)
{
var rocketInstance : Rigidbody;
rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, barrelEnd.rotation);
rocketInstance.AddForce(barrelEnd.forward * 5000);
countdown = 3f;
}
}