Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     //if wave is on
     if (controller.CanSpawn() && activeWave)
     {
         currentSpawnrate += Time.deltaTime * 1;
         if (currentSpawnrate >= controller.defaultEnemySpawnRate)
         {
             if (Physics.OverlapBox(transform.position, transform.localScale, Quaternion.identity, 0, QueryTriggerInteraction.Ignore).Length == 0)
             {
                 Instantiate(spawnedEnemy, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
                 currentSpawnrate = 0;
             }
         }
     }
 }