void SpawnNewBase() { int idx = -1; foreach (CoolDownTimer cdt in cdTimerList) { if (cdt.t == 0) { if (cdt.coolDownTimer.Equals(0)) { int x = Random.Range(40, 180); int z = Random.Range(40, 180); LatentCreature c = Instantiate(latentCreature); c.Initialize(new Vector3(x, 0, z)); latentCreatureList.Add(c); idx = cdTimerList.IndexOf(cdt); Destroy(cdt.gameObject); } } } if (idx >= 0) { cdTimerList.RemoveAt(idx); } }
void SpawnBase() { for (int i = 0; i < NUM_BASE; i++) { int x = Random.Range(40, 180); int z = Random.Range(40, 180); LatentCreature c = Instantiate(latentCreature); //Instantiate(latentCreature); //latentCreature.Initialize(new Vector3(x, 0, z)); c.Initialize(new Vector3(x, 0, z)); latentCreatureList.Add(c); } }