stuff
This commit is contained in:
@@ -4,6 +4,9 @@ using UnityEngine;
|
||||
|
||||
public class MonsterSpawner : MonoBehaviour {
|
||||
public GameObject monsterPrefab;
|
||||
public GameObject monsterPrefab2;
|
||||
public GameObject monsterPrefab3;
|
||||
public GameObject monsterPrefab4;
|
||||
public Vector2 motion;
|
||||
public float delay;
|
||||
|
||||
@@ -12,6 +15,16 @@ public class MonsterSpawner : MonoBehaviour {
|
||||
void Awake() {
|
||||
audioSource = GetComponent<AudioSource> ();
|
||||
|
||||
if (monsterPrefab2 == null) {
|
||||
monsterPrefab2 = monsterPrefab;
|
||||
}
|
||||
if (monsterPrefab3 == null) {
|
||||
monsterPrefab3 = monsterPrefab;
|
||||
}
|
||||
if (monsterPrefab4 == null) {
|
||||
monsterPrefab4 = monsterPrefab;
|
||||
}
|
||||
|
||||
StartCoroutine (SpawnMonster ());
|
||||
}
|
||||
|
||||
@@ -22,6 +35,25 @@ public class MonsterSpawner : MonoBehaviour {
|
||||
monster.transform.position = transform.position;
|
||||
monster.GetComponent<Rigidbody2D> ().velocity = motion;
|
||||
audioSource.Play ();
|
||||
|
||||
//ugly duplication
|
||||
yield return new WaitForSeconds (delay);
|
||||
monster = Instantiate (monsterPrefab2);
|
||||
monster.transform.position = transform.position;
|
||||
monster.GetComponent<Rigidbody2D> ().velocity = motion;
|
||||
audioSource.Play ();
|
||||
|
||||
yield return new WaitForSeconds (delay);
|
||||
monster = Instantiate (monsterPrefab3);
|
||||
monster.transform.position = transform.position;
|
||||
monster.GetComponent<Rigidbody2D> ().velocity = motion;
|
||||
audioSource.Play ();
|
||||
|
||||
yield return new WaitForSeconds (delay);
|
||||
monster = Instantiate (monsterPrefab4);
|
||||
monster.transform.position = transform.position;
|
||||
monster.GetComponent<Rigidbody2D> ().velocity = motion;
|
||||
audioSource.Play ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user