private void SpawnCoffeeMaker(CoffeeMakerType coffeeMakerType) { GameObject coffeeMakerPrefab = _coffeeMakerPrefabs[coffeeMakerType]; Vector3 spawnPoint = RandomSpawnPoint(); var coffeeMaker = Instantiate(coffeeMakerPrefab, spawnPoint, Quaternion.identity) as GameObject; coffeeMaker.transform.SetParent(transform); coffeeMaker.GetComponent <CoffeeMaker>().Died += () => _coffeeMakersAlive--; }
private IEnumerator SpawnCoffeeMakers(CoffeeMakerType type, int amount, float timeBetweenSpawns) { for (int i = 0; i < amount; i++) { yield return(new WaitForSeconds(timeBetweenSpawns)); SpawnCoffeeMaker(type); } }