void LateUpdate() { if (_timeToSpawn && !_occupied) { //Spawn random rodent based on prefab int index = Random.Range(0, _AvailableRodents.Count); // Debug.LogWarning( " Must not be inclusive, chose index=" + index); Rodent.eRodentType selected = (Rodent.eRodentType)_AvailableRodents[index]; SpawnRodent(selected); StartCoroutine(SpawnCountDown()); } }
private void SpawnRodent(Rodent.eRodentType type) { if (!_occupied) { //Spawn Recruitable Rodents if (type == Rodent.eRodentType.Rat) { spawnThis(Rat, _EnemySpawn); } else if (type == Rodent.eRodentType.Beaver) { spawnThis(Beaver, _EnemySpawn); } else if (type == Rodent.eRodentType.Porcupine) { spawnThis(Porcupine, _EnemySpawn); } else if (type == Rodent.eRodentType.Rabbit) { spawnThis(Rabbit, _EnemySpawn); } } }
public void AddType(Rodent.eRodentType type) { _AvailableRodents.Add(type); }