public void DestroyAsteroid() { if (big) { if (asteroidManager == null) { asteroidManager = GameObject.Find("GameManager").GetComponent <AsteroidManager>(); } asteroidManager.SpawnSmallAsteroids(transform.position); } gameObject.SetActive(false); }
private IEnumerator SpawnAsteroids() { while (true) { if (_asteroidManager.NumberOfSmallAsteroids < CurrentDifficulty.MinimumSmallAsteroids) { _asteroidManager.SpawnSmallAsteroids(1); } else if (_asteroidManager.NumberOfMediumAsteroids < CurrentDifficulty.MinimumMediumAsteroids) { _asteroidManager.SpawnMediumAsteroids(1); } else if (_asteroidManager.NumberOfBigAsteroids < CurrentDifficulty.MinimumBigAsteroids) { _asteroidManager.SpawnBigAsteroids(1); } yield return(new WaitForSeconds(CurrentDifficulty.TimeBetweenSpawns)); } }