var bulletCasePrefab : GameObject;
var rate : float = 8.0;
var velocity : Vector3;
var on : boolean = true;
private var nextbulletCaseTime : float;
function Update () {
if (on){
if(Time.time > nextbulletCaseTime){
nextbulletCaseTime = Time.time + (1.0 / rate);
var newBulletCase : GameObject = Instantiate(bulletCasePrefab,transform.position,transform.rotation);
newBulletCase.GetComponent(bulletCase).velocity = transform.TransformDirection(velocity) + Random.insideUnitSphere * 0.3;
}
}
}
You need to supply more information than that. What you are trying to do is probably very simple and can be solved quickly, but this question is going to get ignored because it's not complete. First of all, what's the code that you've posted do, and what are you trying to make happen?
var shootSound :AudioClip; // be sure to add your audio file to this variable in the inspector
// if you want to play an audio file
audio.clip = shootSound;
audio.Play();
You need to supply more information than that. What you are trying to do is probably very simple and can be solved quickly, but this question is going to get ignored because it's not complete. First of all, what's the code that you've posted do, and what are you trying to make happen?
– hoy_smallfry