private void FixedUpdate() { if (GameManager.Instance.GameState != GameState.Play) { return; } // Compute span interval based on passed asteroids count var spawnInterval = Mathf.Max(2.0f - GameManager.Instance.PassedAsteroids * 0.1f, 0.5f); if (interval >= spawnInterval) { var randomIndex = frameRandom.Generate(); // Map random index onto x range var x = Min + (Max - Min) * ((float)randomIndex / (ZoneCount - 1)); // Spawn asteroid using object pool var asteroid = asteroidPool.Capture(); asteroid.SetActive(true); createdAsteroids.Add(asteroid); asteroid.transform.position = new Vector3(x, 19, 113); interval %= spawnInterval; } interval += Time.deltaTime; }