Okay I have tried to research this using both the scripting reference and on Unity Answers but I guess I am having troubles understanding the Instantiate function with my random ammo spawning script.
I am wanting to spawn a random ammo kit at a specific spawn point. I am setting up the variables or instantiate right? I am a compete noob when it comes to scripting.
var ammo = 0;
var pistolAmmo = GameObject;
var rifleAmmo = GameObject;
var shotgunAmmo = GameObject;
var assaultAmmo = GameObject;
var x = 0;
var y = 0;
var z = 0;
function Start () {
AmmoSpawn();
}
function AmmoSpawn() {
ammo = Random.Range(1, 4);
switch(ammo)
{
case 1: //Spawns Pistol Ammo
Instantiate (pistolAmmo, Vector3(x, y, z), Quaternion.identity);
break;
case 2: //Spawns Rifle Ammo
Instantiate(rifleAmmo, Vector3(x, y, z), Quaternion.identity);
break;
case 3: //Spawns shotgun Ammo
Instantiate(shotgunAmmo, Vector3(x, y, z), Quaternion.identity);
break;
default: //Spawns assault Rifle Ammo
Instantiate(assaultAmmo, Vector3(x, y, z), Quaternion.identity);
}
}