Guest

Untitled

By: a guest on Jan 28th, 2012  |  syntax: C#  |  size: 0.39 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1.         GameObject[] cubeArray;
  2.         public void spawnBullets() {
  3.                 for (int j = 0; j < 10; j++)
  4.                 {
  5.                         GameObject newCube = Instantiate(prefab, prefab.transform.position, Quaternion.identity);      
  6.                         cubeArray[cubeArray.Length+1] = newCube;
  7.                 }
  8.                
  9.                 for (int i = 0; i <= cubeArray.Length; i++)
  10.                 {
  11.                         if (cubeArray[i].transform.position.y < 100)
  12.                         {
  13.                                 Destroy(cubeArray[i]);
  14.                                
  15.                         }
  16.                 }
  17.         }