Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2019
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1.     public float spawnDelay;
  2.     public float difficultyFactor = 1000;
  3.     // Use this for initialization
  4.     void Start () {
  5.         StartCoroutine(spawnEnemies());
  6.     }
  7.    
  8.  
  9.     IEnumerator spawnEnemies()
  10.     {
  11.         int nbEnemies = Mathf.RoundToInt(Mathf.Sqrt(Time.time / difficultyFactor));
  12.         for (int i = 0; i < nbEnemies; i++)
  13.         {
  14.             //SPAWN YOUR ENEMIE
  15.         }
  16.         yield return new WaitForSeconds(spawnDelay);
  17.         StartCoroutine(spawnEnemies());
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement