Exemplo n.º 1
0
 private void Update()
 {
     spawnTimer -= Time.deltaTime;
     if (spawnTimer <= 0f)
     {
         // Base time
         spawnTimer = (spawnInterval + spawnTimer) / (1 + (Time.timeSinceLevelLoad / 60) * (speedUpPercentDuringMinute / 100));
         // Logic for determining spawn position. Currently completely random.
         Vector3      spawnPos = spawnDistance * Random.insideUnitCircle.normalized;
         TargetObject target   = objectPool.GetItem(targetPrefab, transform).GetComponent <TargetObject>();
         targets.Add(target);
         target.BeginMove(spawnPos, transform.position);
         target.EndReached += TargetPathEndReached;
     }
 }