Esempio n. 1
0
 public IEnumerator Spawn(BaddieGroup bg)
 {
     for (int idx = 0; idx < bg.amount; idx++)
     {
         bool    overlapping = true;
         Vector3 pos         = new Vector3(Random.Range(-width / 2, width / 2), 0, Random.Range(-height / 2, height / 2));
         pos += transform.position;
         while (preventOverlap && overlapping)
         {
             pos  = new Vector3(Random.Range(-width / 2, width / 2), 0, Random.Range(-height / 2, height / 2));
             pos += transform.position;
             if (!Physics.CheckSphere(pos, 1.0f))
             {
                 overlapping = false;
             }
         }
         Transform spawned = (Transform)Instantiate(bg.baddieType, pos, transform.rotation);
         spawned.GetComponent <Baddie>().Spawner = this;
         aliveCount++;
         yield return(new WaitForSeconds(bg.spawnDelay));
     }
 }
Esempio n. 2
0
	public IEnumerator RunSpawner(BaddieGroup bg, float startDelay){
		yield return new WaitForSeconds(startDelay);
		GameObject.Find(bg.spawner).GetComponent<Spawner>().Run(bg);
	}
Esempio n. 3
0
 public void Run(BaddieGroup bg)
 {
     StartCoroutine(Spawn(bg));
 }
Esempio n. 4
0
    public IEnumerator RunSpawner(BaddieGroup bg, float startDelay)
    {
        yield return(new WaitForSeconds(startDelay));

        GameObject.Find(bg.spawner).GetComponent <Spawner>().Run(bg);
    }