Esempio n. 1
0
 void SpawnLine()
 {
     enemyLine.preconfs = preconfsQueue.Peek();
     line = Instantiate(enemyLine.gameObject, transform.position, Quaternion.identity) as GameObject;
     line.transform.parent = this.transform;
     if (idx < 6)
     {
         if (++currentLine == limits [idx])
         {
             currentLine = 0;
             idx++;
             if (idx < 6)
             {
                 preconfsQueue.Dequeue();
                 BackgroundController backgroundController = GameObject.Find("BackgroundController").
                                                             GetComponent <BackgroundController>();
                 backgroundController.ActivateEndless();
             }
         }
     }
     else if (idx == 6 && spawnInterval > 0.01f)
     {
         if (spawnInterval != 0.01f)
         {
             spawnInterval -= 0.005f;
         }
         CancelInvoke("SpawnLine");
         Invoke("SpawnLine", spawnInterval);
         Invoke("SpawnEnemy", maxSpawnRateInSeconds);
     }
 }