Shotlock System

I’m trying to make a Shotlock system similar to the one found in Kingdom Hearts BBS, as seen below:
This Video
Only to be used as a first person perspective.

Now I’ve figured that I can use raycast to select the enemy by running the target sight over the enemy, and store the enemies in an array, until it hits the preset array limit. Once it does, it uses a “For” loop to fire off the number of shots, which will track the enemy in that array slot.

The problem is that arrays aren’t my strong point and can someone show me an example?

Edit:

The script semi works but it can’t set the target of the Homing shot and it can’t get the same enemy more than once. Any advice?

function Update () {
var fwd = transform.TransformDirection (Vector3.forward);
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;

if(Input.GetKeyDown("space") && canShotLock){
isShotLock = true;

	}

if(isShotLock){

if(Input.GetKeyDown("x")){
// On raycast hit, if it's an enemy add it.

if(Physics.Raycast(transform.position, fwd, hit, 100)){
var hite = hit.transform;
print(hite);
if(hite.gameObject.CompareTag("Enemy")){
SLT[current] = hite;
print(SLT[current]);	
current++;
		}
	}
    }

if(Input.GetKeyUp("x")){
ShotLock();
  }

}

function ShotLock(){

current = 0;
while (current < SLT.length){
//current = 0;
//Instanitate
print("Firing");
audio.PlayOneShot(HomingShot);
var slShot = Instantiate(Homing, transform.position, Quaternion.identity);
slShot.transform.GetComponent("Projectile").Target = SLT[current].transform;
slShot.rigidbody.AddForce(transform.forward * 10, ForceMode.Impulse);
current++;
yield WaitForSeconds(0.4);	
}
canShotLock = false;

}

Using http://unity3d.com/support/documentation/ScriptReference/Array.html

Step 1
Create the array, you have an examples here. Instantiate the array with a GameObject Type. You can store the object for ease of consumption.

You’ve already got the raycast part and I presume your using a state machine. When your in the “shot locking” state and your cast ray touches an enemy you can use the raycast hit object to get the hit collider object. From the collider you can get the gameObject and you canstore that in the array, see this previous unityanswers answer which is expanded with this forum post here.

A few counters to measure the volume of enemies targeted and your ready to promote your state machine to a “firing” state where you would pull each item out of the array, see first array link, in turn and shoot blobs at them.

I hope this has conceptually bridged some concepts for you. I haven’t tried to give you any meaningful code as your situation and understanding is unknown to me. It would be better to develop the code to fit rather than copy and paste some off the internet. Knowledge to understand the answer is of as much use than the answer itself.