Example #1
0
 public void addBranchesToTree()
 {
     for (int i = tree.Count - 1; i >= 0; i--)
     {
         GameObject oldBranch = (GameObject)tree[i];
         branchScript = oldBranch.GetComponent <BranchScript>();
         if (!branchScript.hasBeenBranched)
         {
             for (int j = 0; j < Random.Range(3, 6); j++)
             {
                 GameObject newBranch = branchScript.createNewBranch(levelCounter, branchCounter);
                 newBranch.transform.SetParent(t);
                 tree.Add(newBranch);
                 branchCounter++;
             }
             branchScript.setHasBeenBranchedToTrue();
         }
         else
         {
             break;
         }
     }
     levelCounter++;
     branchCounter = 0;
 }