Advertisement
Guest User

Untitled

a guest
Nov 7th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1.     public IEnumerator Summon(int form,int max){ //Summon a formation from the formations array
  2.         while (keepSummoning) {
  3.             if (Enemy.enemiesAlive < max) {
  4.                 setFormLength (form);
  5.                 for (int i = 0; i < currentform.Length; i++) {
  6.                     GameObject newenemy = Instantiate (currentform [i]); //Instantiate one enemy from a child of the formation picked
  7.                     yield return new WaitForSeconds (.1f);
  8.                 }
  9.             }
  10.  
  11.             yield return new WaitForSeconds (spawnrate);
  12.         }
  13.     }
  14.  
  15.     public void setFormLength(int form){
  16.         currentform = new GameObject[formations [form].transform.childCount]; //setting length of currentform
  17.         for (int i = 0; i < currentform.Length; i++){
  18.            
  19.             currentform [i] = formations [form].transform.GetChild(i).gameObject; //set each currentform value to be the next prefab child
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement