public void ResetEnemies() { //there should be no fish in the list while (eaters.Count > 0) { FishEater eater = eaters[0]; eaters.RemoveAt(0); eater.particleSystem.Stop(); Destroy(eater.gameObject, 1.1f); } }
public GameObject SpawnEnemy(Vector3 p_position, Quaternion p_rotation) { GameObject goEater = Instantiate(enemyPrefab, p_position, p_rotation) as GameObject; FishEater f = goEater.GetComponent <FishEater>(); //Start at base speed, then move to max speed based on enemy count f.SetSpeed(Mathf.Lerp(FishEater.MIN_SPEED, FishEater.MAX_SPEED, Mathf.Clamp01(eaters.Count / enemySpeedLerpCeiling))); f.SetEnemyManager(this); f.SetFishManager(fm); eaters.Add(f); return(goEater); }